Skip to content

Commit

Permalink
Showing 11 changed files with 47 additions and 18 deletions.
10 changes: 10 additions & 0 deletions test/truffle/compiler/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Any `*.sh` file placed in this directory will be run as part of the
`jt test compiler` tests. Tests report failure by returning a non-zero exit
code. The tests are run with an environment variable `JAVACMD` set to something
that has Graal (unless `--no-java-cmd` is used.)

Note that tests in this directory should run `ruby` as a command, rather than
`bin/jruby`. `jt` will put `bin` on the path for you. This is so that
people packaging JRuby+Truffle in some unusual way can run their external
packed version against these tests, and the tests aren't hardcoded to always
run `bin/jruby`.
2 changes: 1 addition & 1 deletion test/truffle/compiler/attachments-optimise.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

bin/jruby -X+T -J-G:+TruffleCompilationExceptionsAreFatal test/truffle/compiler/attachments-optimise/attachments-optimise.rb
ruby -X+T -J-G:+TruffleCompilationExceptionsAreFatal test/truffle/compiler/attachments-optimise/attachments-optimise.rb
2 changes: 1 addition & 1 deletion test/truffle/compiler/pe.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

bin/jruby -X+T -J-G:+TruffleCompilationExceptionsAreThrown test/truffle/compiler/pe/pe.rb
ruby -X+T -J-G:+TruffleCompilationExceptionsAreThrown test/truffle/compiler/pe/pe.rb
9 changes: 9 additions & 0 deletions test/truffle/integration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Any `*.sh` file placed in this directory will be run as part of the
`jt test integration` tests. Tests report failure by returning a non-zero exit
code.

Note that tests in this directory should run `ruby` as a command, rather than
`bin/jruby`. `jt` will put `bin` on the path for you. This is so that
people packaging JRuby+Truffle in some unusual way can run their external
packed version against these tests, and the tests aren't hardcoded to always
run `bin/jruby`.
2 changes: 1 addition & 1 deletion test/truffle/integration/coverage.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

bin/jruby -X+T -Xtruffle.coverage=true test/truffle/integration/coverage/test.rb
ruby -X+T -Xtruffle.coverage=true test/truffle/integration/coverage/test.rb
2 changes: 1 addition & 1 deletion test/truffle/integration/pack-real-usage.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

bin/jruby -X+T test/truffle/integration/pack-real-usage/pack-real-usage.rb
ruby -X+T test/truffle/integration/pack-real-usage/pack-real-usage.rb
2 changes: 1 addition & 1 deletion test/truffle/integration/rack-server.sh
Original file line number Diff line number Diff line change
@@ -4,4 +4,4 @@ set -e

bin/jruby -X-T bin/gem install rack -v 1.6.1
source test/truffle/integration/common/test_server.sh.inc
bin/jruby -X+T -Ilib/ruby/gems/shared/gems/rack-1.6.1/lib test/truffle/integration/rack-server/rack-server.rb & test_server
ruby -X+T -Ilib/ruby/gems/shared/gems/rack-1.6.1/lib test/truffle/integration/rack-server/rack-server.rb & test_server
2 changes: 1 addition & 1 deletion test/truffle/integration/sinatra-server.sh
Original file line number Diff line number Diff line change
@@ -7,4 +7,4 @@ bin/jruby -X-T bin/gem install tilt -v 2.0.1
bin/jruby -X-T bin/gem install rack-protection -v 1.5.3
bin/jruby -X-T bin/gem install sinatra -v 1.4.6
source test/truffle/integration/common/test_server.sh.inc
bin/jruby -X+T -Ilib/ruby/gems/shared/gems/rack-1.6.1/lib -Ilib/ruby/gems/shared/gems/tilt-2.0.1/lib -Ilib/ruby/gems/shared/gems/rack-protection-1.5.3/lib -Ilib/ruby/gems/shared/gems/sinatra-1.4.6/lib test/truffle/integration/sinatra-server/sinatra-server.rb & test_server
ruby -X+T -Ilib/ruby/gems/shared/gems/rack-1.6.1/lib -Ilib/ruby/gems/shared/gems/tilt-2.0.1/lib -Ilib/ruby/gems/shared/gems/rack-protection-1.5.3/lib -Ilib/ruby/gems/shared/gems/sinatra-1.4.6/lib test/truffle/integration/sinatra-server/sinatra-server.rb & test_server
2 changes: 1 addition & 1 deletion test/truffle/integration/tcp-server.sh
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@
set -e

source test/truffle/integration/common/test_server.sh.inc
bin/jruby -X+T test/truffle/integration/tcp-server/tcp-server.rb & test_server
ruby -X+T test/truffle/integration/tcp-server/tcp-server.rb & test_server
2 changes: 1 addition & 1 deletion test/truffle/integration/webrick-server.sh
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@
set -e

source test/truffle/integration/common/test_server.sh.inc
bin/jruby -X+T test/truffle/integration/webrick-server/webrick-server.rb & test_server
ruby -X+T test/truffle/integration/webrick-server/webrick-server.rb & test_server
30 changes: 20 additions & 10 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -51,6 +51,20 @@ def self.find_graal
File.executable?(location)
end
end

def self.find_jruby
if USE_JRUBY_ECLIPSE
"#{JRUBY_DIR}/tool/jruby_eclipse"
elsif ENV['RUBY_BIN']
ENV['RUBY_BIN']
else
"#{JRUBY_DIR}/bin/jruby"
end
end

def self.find_jruby_dir
File.dirname(find_jruby)
end

def self.git_branch
@git_branch ||= `GIT_DIR="#{JRUBY_DIR}/.git" git rev-parse --abbrev-ref HEAD`.strip
@@ -208,6 +222,7 @@ def help
puts 'jt test spec/ruby/language run specs in this directory'
puts 'jt test spec/ruby/language/while_spec.rb run specs in this file'
puts 'jt test compiler run compiler tests (uses the same logic as --graal to find Graal)'
puts ' --no-java-cmd don\'t set JAVACMD - rely on bin/jruby or RUBY_BIN to have Graal already'
puts 'jt test integration runs bigger integration tests'
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'
@@ -304,15 +319,7 @@ def run(*args)
end
end

if USE_JRUBY_ECLIPSE
jruby_bin = "#{JRUBY_DIR}/tool/jruby_eclipse"
elsif ENV['RUBY_BIN']
jruby_bin = ENV['RUBY_BIN']
else
jruby_bin = "#{JRUBY_DIR}/bin/jruby"
end

raw_sh env_vars, jruby_bin, *jruby_args, *args
raw_sh env_vars, Utilities.find_jruby, *jruby_args, *args
end
alias ruby run

@@ -374,15 +381,18 @@ def test_mri(*args)
def test_compiler(*args)
env_vars = {}
env_vars["JAVACMD"] = Utilities.find_graal unless args.delete('--no-java-cmd')
env_vars["PATH"] = "#{Utilities.find_jruby_dir}:#{ENV["PATH"]}"
Dir["#{JRUBY_DIR}/test/truffle/compiler/*.sh"].each do |test_script|
sh env_vars, test_script
end
end
private :test_compiler

def test_integration(*args)
env_vars = {}
env_vars["PATH"] = "#{Utilities.find_jruby_dir}:#{ENV["PATH"]}"
Dir["#{JRUBY_DIR}/test/truffle/integration/*.sh"].each do |test_script|
sh test_script
sh env_vars, test_script
end
end
private :test_integration

0 comments on commit 9f53077

Please sign in to comment.