Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 80b37b082b7d
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: abc03a3dafc9
Choose a head ref
  • 4 commits
  • 5 files changed
  • 1 contributor

Commits on Apr 24, 2016

  1. Copy the full SHA
    f0cc1a6 View commit details
  2. Copy the full SHA
    e3112b2 View commit details
  3. Copy the full SHA
    3c53ea0 View commit details
  4. [Truffle] jt test cexts

    chrisseaton committed Apr 24, 2016
    Copy the full SHA
    abc03a3 View commit details
Showing with 23 additions and 7 deletions.
  1. +1 −0 .gitignore
  2. +1 −7 bin/jruby-cext-c
  3. +1 −0 test/truffle/cexts/minimum/expected.txt
  4. +2 −0 test/truffle/cexts/minimum/ext/minimum/extconf.rb
  5. +18 −0 tool/jt.rb
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -82,6 +82,7 @@ reference.txt
rubyspec_temp
.polyglot.pom.rb
tool/truffle/jruby_truffle_runner/jruby+truffle_runner-*.gem
test/truffle/cexts/**/Makefile

# binaries
!bin/gem
8 changes: 1 addition & 7 deletions bin/jruby-cext-c
Original file line number Diff line number Diff line change
@@ -12,20 +12,14 @@

require 'yaml'

MX_DIR = ENV['MX_DIR']

unless MX_DIR
abort 'You need to set MX_DIR to a checkout of the mx repository'
end

SULONG_DIR = ENV['SULONG_DIR']

unless SULONG_DIR
abort 'You need to set SULONG_DIR to the location of a built checkout of the Sulong repository'
end

def mx(command, *args)
command = "#{MX_DIR}/mx.py -p #{SULONG_DIR} --vm server #{command} #{args.join(' ')}"
command = "mx -p #{SULONG_DIR} --vm server #{command} #{args.join(' ')}"
puts "$ #{command}"
`#{command}`
end
1 change: 1 addition & 0 deletions test/truffle/cexts/minimum/expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello!
2 changes: 2 additions & 0 deletions test/truffle/cexts/minimum/ext/minimum/extconf.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require 'mkmf'
create_makefile('minimum')
18 changes: 18 additions & 0 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -297,6 +297,7 @@ def help
puts ' --no-java-cmd don\'t set JAVACMD - rely on bin/jruby or RUBY_BIN to have Graal already'
puts 'jt test integration [fast|long|all] runs bigger integration tests (fast is default)'
puts ' --no-gems don\'t run tests that install gems'
puts 'jt test cexts run C extension tests (set SULONG_DIR)'
puts 'jt tag spec/ruby/language tag failing specs in this directory'
puts 'jt tag spec/ruby/language/while_spec.rb tag failing specs in this file'
puts 'jt tag all spec/ruby/language tag all specs in this file, without running them'
@@ -458,7 +459,9 @@ def test(*args)
# test_mri # TODO (pitr-ch 29-Mar-2016): temporarily disabled
test_integration({'CI' => 'true', 'HAS_REDIS' => 'true'}, 'all')
test_compiler
test_cexts if ENV['SULONG_DIR']
when 'compiler' then test_compiler(*rest)
when 'cexts' then test_cexts(*rest)
when 'integration' then test_integration({}, *rest)
when 'specs' then test_specs('run', *rest)
when 'tck' then
@@ -504,6 +507,21 @@ def test_compiler(*args)
end
private :test_compiler

def test_cexts(*args)
output_file = 'cext-output.txt'
Dir["#{JRUBY_DIR}/test/truffle/cexts/*"].each do |dir|
sh Utilities.find_jruby, "#{JRUBY_DIR}/bin/jruby-cext-c", dir
name = File.basename(dir)
run '--sulong', '-I', File.join(dir, 'lib'), File.join(dir, 'bin', name), :out => output_file
unless File.read(output_file) == File.read(File.join(dir, 'expected.txt'))
abort "c extension #{dir} didn't work as expected"
end
end
ensure
File.delete output_file
end
private :test_cexts

def test_integration(env, *args)
no_gems = args.delete('--no-gems')