Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/truffle-head'
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Sep 27, 2016
2 parents f6c16b9 + 39c79f3 commit 2481b86
Show file tree
Hide file tree
Showing 30 changed files with 126 additions and 95 deletions.
15 changes: 11 additions & 4 deletions lib/ruby/truffle/jruby+truffle/lib/truffle/runner.rb
Expand Up @@ -186,6 +186,8 @@ def log(message)
ROOT = Pathname(__FILE__).dirname.parent.parent.expand_path
JRUBY_PATH = ROOT.join('../../../..').expand_path
JRUBY_BIN = JRUBY_PATH.join('bin', 'jruby')
JT = JRUBY_PATH.join('tool', 'jt.rb')
INTERPRETER_PATH = JT.exist? ? [JT.to_s, "ruby"] : JRUBY_BIN.to_s

module OptionBlocks
STORE_NEW_VALUE = -> (new, old, _) { new }
Expand Down Expand Up @@ -248,8 +250,7 @@ module OptionBlocks
}.merge(shared_offline_options),
run: {
help: ['-h', '--help', 'Show this message', STORE_NEW_VALUE, false],
interpreter_path: ['--interpreter-path PATH', "Path to #{BRANDING} interpreter executable", STORE_NEW_VALUE,
JRUBY_BIN],
interpreter_path: ['--interpreter-path PATH', "Path to #{BRANDING} interpreter executable", STORE_NEW_VALUE, INTERPRETER_PATH],
no_truffle: ['-n', '--no-truffle', "Use conventional JRuby instead of #{BRANDING}", STORE_NEW_NEGATED_VALUE, false],
graal: ['-g', '--graal', 'Run on graal', STORE_NEW_VALUE, false],
build: ['-b', '--build', 'Run `jt build` using conventional JRuby', STORE_NEW_VALUE, false],
Expand Down Expand Up @@ -417,6 +418,11 @@ def verbose?
@options[:global][:verbose]
end

def interpreter_path
# Might be an Array or just a String
[*@options[:run][:interpreter_path]]
end

def build_option_parsers
option_parsers = OPTION_DEFINITIONS.each_with_object({}) do |(name, parser_options), parsers|
parsers[name] = build_option_parser(parser_options, @options.fetch(name))
Expand Down Expand Up @@ -575,6 +581,7 @@ def subcommand_setup(rest)
gemfile_use_path!(target_gem_path) if @options[:setup][:offline]

execute_cmd([JRUBY_BIN.to_s,
'-X-C', # See https://github.com/jruby/jruby/issues/4171
"#{Gem.bindir}/bundle",
*bundle_options,
'install',
Expand Down Expand Up @@ -603,7 +610,7 @@ def subcommand_setup(rest)
end

def subcommand_run(rest)
jruby_path = Pathname("#{@options[:run][:interpreter_path]}/../..").expand_path
jruby_path = Pathname("#{interpreter_path[0]}/../..").expand_path
raise unless jruby_path.absolute?
ruby_options, rest = if rest.include?('--')
split = rest.index('--')
Expand Down Expand Up @@ -659,7 +666,7 @@ def subcommand_run(rest)
env.each { |k, v| env[k] = v.to_s }

cmd = [(env unless env.empty?),
@options[:run][:interpreter_path].to_s,
*interpreter_path,
*jruby_options,
*env_options,
executable,
Expand Down
8 changes: 4 additions & 4 deletions lib/ruby/truffle/truffle/openssl.rb
Expand Up @@ -6,15 +6,15 @@
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

if ENV['JRUBY_TRUFFLE_SHIM_OPENSSL']
if ENV['JRUBY_TRUFFLE_NATIVE_OPENSSL']
$LOAD_PATH.unshift File.expand_path('../../openssl', __FILE__)
require_relative '../openssl/openssl'
else
# If loaded directly simulate as it was not found, it can added only
# explicitly by loading openssl-stubs which makes it look like
# openssl was loaded.

load_error = LoadError.new('cannot load such file -- openssl')
load_error.instance_variable_set :@path, 'openssl'
raise load_error
else
$LOAD_PATH.unshift File.expand_path('../../openssl', __FILE__)
require_relative '../openssl/openssl.rb'
end
Expand Up @@ -18,3 +18,7 @@ function test_server {
exit 1
fi
}

function jt {
ruby tool/jt.rb "$@"
}
4 changes: 3 additions & 1 deletion test/truffle/compiler/attachments-optimise.sh
@@ -1,4 +1,6 @@
#!/usr/bin/env bash

source test/truffle/common.sh.inc

# relies on value profiling
ruby -X+T -J-G:+TruffleCompilationExceptionsAreFatal -Xtruffle.basic_ops.inline=false test/truffle/compiler/attachments-optimise/attachments-optimise.rb
jt ruby --graal -J-G:+TruffleCompilationExceptionsAreFatal -Xtruffle.basic_ops.inline=false test/truffle/compiler/attachments-optimise/attachments-optimise.rb
4 changes: 3 additions & 1 deletion test/truffle/compiler/osr.sh
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

ruby -X+T -J-G:+TruffleCompilationExceptionsAreFatal test/truffle/compiler/osr/osr.rb
source test/truffle/common.sh.inc

jt ruby --graal -J-G:+TruffleCompilationExceptionsAreFatal test/truffle/compiler/osr/osr.rb
4 changes: 3 additions & 1 deletion test/truffle/compiler/pe.sh
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

ruby -X+T -J-G:+TruffleCompilationExceptionsAreThrown -Xtruffle.basic_ops.inline=false test/truffle/compiler/pe/pe.rb
source test/truffle/common.sh.inc

jt ruby --graal -J-G:+TruffleCompilationExceptionsAreThrown -Xtruffle.basic_ops.inline=false test/truffle/compiler/pe/pe.rb
4 changes: 3 additions & 1 deletion test/truffle/compiler/stf-optimises.sh_excluded
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

ruby -X+T -J-G:+TruffleCompilationExceptionsAreFatal test/truffle/compiler/stf-optimises/stf-optimises.rb
source test/truffle/common.sh.inc

jt ruby --graal -J-G:+TruffleCompilationExceptionsAreFatal test/truffle/compiler/stf-optimises/stf-optimises.rb
4 changes: 3 additions & 1 deletion test/truffle/compiler/tp-optimises.sh_excluded
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

ruby -X+T -J-G:+TruffleCompilationExceptionsAreFatal test/truffle/compiler/tp-optimises/tp-optimises.rb
source test/truffle/common.sh.inc

jt ruby --graal -J-G:+TruffleCompilationExceptionsAreFatal test/truffle/compiler/tp-optimises/tp-optimises.rb
2 changes: 1 addition & 1 deletion test/truffle/ecosystem/gem-testing.sh
Expand Up @@ -2,4 +2,4 @@

set -e

jruby+truffle --dir ../jruby-truffle-gem-test-pack/gem-testing ci --offline --batch test/truffle/ecosystem/batch.yaml
bin/jruby+truffle --dir ../jruby-truffle-gem-test-pack/gem-testing ci --offline --batch test/truffle/ecosystem/batch.yaml
4 changes: 3 additions & 1 deletion test/truffle/gems/asciidoctor.sh
@@ -1,10 +1,12 @@
#!/usr/bin/env bash

source test/truffle/common.sh.inc

set -e

GEM_HOME=${GEM_HOME:-lib/ruby/gems/shared}

ruby -X+T $GEM_HOME/gems/asciidoctor-1.5.4/bin/asciidoctor --attribute last-update-label!= test/truffle/gems/asciidoctor/userguide.adoc
jt ruby $GEM_HOME/gems/asciidoctor-1.5.4/bin/asciidoctor --attribute last-update-label!= test/truffle/gems/asciidoctor/userguide.adoc

if ! cmp --silent test/truffle/gems/asciidoctor/userguide.html test/truffle/gems/asciidoctor/userguide-expected.html
then
Expand Down
8 changes: 5 additions & 3 deletions test/truffle/gems/execjs.sh
@@ -1,9 +1,11 @@
#!/usr/bin/env bash

source test/truffle/common.sh.inc

set -e

GEM_HOME=${GEM_HOME:-lib/ruby/gems/shared}

ruby -X+T -I$GEM_HOME/gems/execjs-2.6.0/lib test/truffle/gems/execjs/checkruntime.rb
ruby -X+T -I$GEM_HOME/gems/execjs-2.6.0/lib test/truffle/gems/execjs/simple.rb
ruby -X+T -I$GEM_HOME/gems/execjs-2.6.0/lib test/truffle/gems/execjs/coffeescript.rb
jt ruby -I$GEM_HOME/gems/execjs-2.6.0/lib test/truffle/gems/execjs/checkruntime.rb
jt ruby -I$GEM_HOME/gems/execjs-2.6.0/lib test/truffle/gems/execjs/simple.rb
jt ruby -I$GEM_HOME/gems/execjs-2.6.0/lib test/truffle/gems/execjs/coffeescript.rb
2 changes: 2 additions & 0 deletions test/truffle/gems/install-gems.sh
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

source test/truffle/common.sh.inc

set -e
set -x

Expand Down
6 changes: 3 additions & 3 deletions test/truffle/gems/rack-server.sh
@@ -1,9 +1,9 @@
#!/usr/bin/env bash

source test/truffle/common.sh.inc

set -e

GEM_HOME=${GEM_HOME:-lib/ruby/gems/shared}

source test/truffle/common/test_server.sh.inc

ruby -X+T -I$GEM_HOME/gems/rack-1.6.1/lib test/truffle/gems/rack-server/rack-server.rb & test_server
jt ruby -I$GEM_HOME/gems/rack-1.6.1/lib test/truffle/gems/rack-server/rack-server.rb & test_server
14 changes: 7 additions & 7 deletions test/truffle/gems/sinatra-server.sh
@@ -1,13 +1,13 @@
#!/usr/bin/env bash

source test/truffle/common.sh.inc

set -e

GEM_HOME=${GEM_HOME:-lib/ruby/gems/shared}

source test/truffle/common/test_server.sh.inc

ruby -X+T -I$GEM_HOME/gems/rack-1.6.1/lib \
-I$GEM_HOME/gems/tilt-2.0.1/lib \
-I$GEM_HOME/gems/rack-protection-1.5.3/lib \
-I$GEM_HOME/gems/sinatra-1.4.6/lib \
test/truffle/gems/sinatra-server/sinatra-server.rb & test_server
jt ruby -I$GEM_HOME/gems/rack-1.6.1/lib \
-I$GEM_HOME/gems/tilt-2.0.1/lib \
-I$GEM_HOME/gems/rack-protection-1.5.3/lib \
-I$GEM_HOME/gems/sinatra-1.4.6/lib \
test/truffle/gems/sinatra-server/sinatra-server.rb & test_server
4 changes: 3 additions & 1 deletion test/truffle/integration/backtraces.sh
@@ -1,9 +1,11 @@
#!/usr/bin/env bash

source test/truffle/common.sh.inc

set -e

for f in test/truffle/integration/backtraces/*.rb
do
echo $f
ruby -X+T $f
jt ruby --no-core-load-path $f
done
4 changes: 3 additions & 1 deletion test/truffle/integration/coverage.sh
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

ruby -X+T test/truffle/integration/coverage/test.rb
source test/truffle/common.sh.inc

jt ruby test/truffle/integration/coverage/test.rb
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

source test/truffle/common.sh.inc

set -e
set -x

Expand All @@ -8,7 +10,7 @@ SLEEP_LINE=4

# Test /stacks

ruby -X+T -Xtruffle.instrumentation_server_port=$PORT test/truffle/integration/instrumentation-server/subject.rb &
jt ruby -Xtruffle.instrumentation_server_port=$PORT test/truffle/integration/instrumentation-server/subject.rb &
pid=$!

while [ ! -e ready.txt ]; do
Expand All @@ -34,7 +36,7 @@ rm ready.txt
# Test /break

( echo backtrace ; echo 20000+1400 ; echo exit ) > in.txt
ruby -X+T -Xtruffle.instrumentation_server_port=$PORT test/truffle/integration/instrumentation-server/subject.rb < in.txt > out.txt &
jt ruby -Xtruffle.instrumentation_server_port=$PORT test/truffle/integration/instrumentation-server/subject.rb < in.txt > out.txt &
pid=$!

while [ ! -e ready.txt ]; do
Expand Down
4 changes: 3 additions & 1 deletion test/truffle/integration/irb.sh
@@ -1,8 +1,10 @@
#!/usr/bin/env bash

source test/truffle/common.sh.inc

set -e

ruby -X+T -S irb < test/truffle/integration/irb/input.txt > temp.txt
jt ruby -S irb < test/truffle/integration/irb/input.txt > temp.txt

if ! cmp --silent temp.txt test/truffle/integration/irb/output.txt
then
Expand Down
4 changes: 3 additions & 1 deletion test/truffle/integration/java-platform.sh
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

ruby -X+T -Xtruffle.platform.use_java=true -e 'puts 14'
source test/truffle/common.sh.inc

jt ruby -Xtruffle.platform.use_java=true -e 'puts 14'
6 changes: 4 additions & 2 deletions test/truffle/integration/js.sh
@@ -1,6 +1,8 @@
#!/usr/bin/env bash

source test/truffle/common.sh.inc

set -e

ruby -X+T test/truffle/integration/js/eval.rb
ruby -X+T test/truffle/integration/js/inline-exported.rb
jt ruby test/truffle/integration/js/eval.rb
jt ruby test/truffle/integration/js/inline-exported.rb
4 changes: 3 additions & 1 deletion test/truffle/integration/pack-real-usage.sh
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

ruby -X+T test/truffle/integration/pack-real-usage/pack-real-usage.rb
source test/truffle/common.sh.inc

jt ruby test/truffle/integration/pack-real-usage/pack-real-usage.rb
4 changes: 3 additions & 1 deletion test/truffle/integration/r.sh
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

source test/truffle/common.sh.inc

set -e

ruby -X+T test/truffle/integration/r/eval.rb
jt ruby test/truffle/integration/r/eval.rb
4 changes: 3 additions & 1 deletion test/truffle/integration/safe.sh
@@ -1,7 +1,9 @@
#!/usr/bin/env bash

source test/truffle/common.sh.inc

function run {
ruby -X+T -Xtruffle.platform.safe=false "$@"
jt ruby -Xtruffle.platform.safe=false "$@"
}

function safe {
Expand Down
4 changes: 3 additions & 1 deletion test/truffle/integration/sl.sh
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

source test/truffle/common.sh.inc

set -e

ruby -X+T test/truffle/integration/sl/inline-exported.rb
jt ruby test/truffle/integration/sl/inline-exported.rb
5 changes: 3 additions & 2 deletions test/truffle/integration/tcp-server.sh
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

source test/truffle/common.sh.inc

set -e

source test/truffle/common/test_server.sh.inc
ruby -X+T test/truffle/integration/tcp-server/tcp-server.rb & test_server
jt ruby test/truffle/integration/tcp-server/tcp-server.rb & test_server
4 changes: 3 additions & 1 deletion test/truffle/integration/tracing.sh
@@ -1,9 +1,11 @@
#!/usr/bin/env bash

source test/truffle/common.sh.inc

set -e

for f in test/truffle/integration/tracing/*.rb
do
echo $f
ruby -X+T $f
jt ruby $f
done
5 changes: 3 additions & 2 deletions test/truffle/integration/webrick-server.sh
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

source test/truffle/common.sh.inc

set -e

source test/truffle/common/test_server.sh.inc
ruby -X+T test/truffle/integration/webrick-server/webrick-server.rb & test_server
jt ruby test/truffle/integration/webrick-server/webrick-server.rb & test_server

0 comments on commit 2481b86

Please sign in to comment.