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: a9ea20ca365e
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9cd2ccc43470
Choose a head ref
  • 4 commits
  • 7 files changed
  • 1 contributor

Commits on May 18, 2016

  1. Copy the full SHA
    c9145b8 View commit details
  2. Copy the full SHA
    7ee1b4b View commit details
  3. Copy the full SHA
    7f0e734 View commit details
  4. Copy the full SHA
    9cd2ccc View commit details
6 changes: 6 additions & 0 deletions test/truffle/integration/js.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -e

ruby -X+T test/truffle/integration/js/eval.rb
ruby -X+T test/truffle/integration/js/inline-exported.rb
15 changes: 15 additions & 0 deletions test/truffle/integration/js/eval.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. This
# code is released under a tri EPL/GPL/LGPL license. You can use it,
# redistribute it and/or modify it under the terms of the:
#
# Eclipse Public License version 1.0
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

unless Truffle::Interop.mime_type_supported?('application/javascript')
abort 'JavaScript doesn\'t appear to be available - skipping JavaScript test'
end

if Truffle::Interop.eval('application/javascript', '14 + 2') != 16
abort 'result not as expected'
end
30 changes: 30 additions & 0 deletions test/truffle/integration/js/inline-exported.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. This
# code is released under a tri EPL/GPL/LGPL license. You can use it,
# redistribute it and/or modify it under the terms of the:
#
# Eclipse Public License version 1.0
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

unless Truffle::Interop.mime_type_supported?('application/javascript')
abort 'JavaScript doesn\'t appear to be available - skipping JavaScript test'
end

Truffle::Interop.eval('application/javascript', %{
function clamp(min, max, value) {
if (value < min) {
return min;
} else if (value > max) {
return max;
} else {
return value;
}
}
Interop.export('clamp', clamp.bind(this));
})

Truffle::Interop.import_method(:clamp)

if clamp(10, 90, 46) != 46
abort 'result not as expected'
end
3 changes: 1 addition & 2 deletions test/truffle/integration/r/eval.rb
Original file line number Diff line number Diff line change
@@ -7,8 +7,7 @@
# GNU Lesser General Public License version 2.1

unless Truffle::Interop.mime_type_supported?('application/x-r')
puts "R doesn't appear to be available - skipping R test"
exit
abort 'R doesn\'t appear to be available - skipping R test'
end

if Truffle::Interop.eval('application/x-r', '14 + 2') != 16
5 changes: 5 additions & 0 deletions test/truffle/integration/sl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

set -e

ruby -X+T test/truffle/integration/sl/inline-exported.rb
28 changes: 28 additions & 0 deletions test/truffle/integration/sl/inline-exported.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. This
# code is released under a tri EPL/GPL/LGPL license. You can use it,
# redistribute it and/or modify it under the terms of the:
#
# Eclipse Public License version 1.0
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

unless Truffle::Interop.mime_type_supported?('application/x-sl')
abort 'SL doesn\'t appear to be available - skipping SL test'
end

Truffle::Interop.eval('application/x-sl', %{
function clamp(min, max, value) {
if (value < min) {
return min;
}
if (value > max) {
return max;
}
return value;
}})

Truffle::Interop.import_method(:clamp)

if clamp(10, 90, 46) != 46
abort 'result not as expected'
end
18 changes: 18 additions & 0 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -85,6 +85,12 @@ def self.find_graal_js
raise "couldn't find trufflejs.jar - download GraalVM as described in https://github.com/jruby/jruby/wiki/Downloading-GraalVM and find it in there"
end

def self.find_sl
jar = ENV['SL_JAR']
return jar if jar
raise "couldn't find truffle-sl.jar - build Truffle and find it in there"
end

def self.find_sulong_dir
dir = ENV['SULONG_DIR']
return dir if dir
@@ -350,6 +356,7 @@ def help
puts ' JVMCI_DIR JMVCI repository checkout to use when running IGV (mx must already be on the $PATH)'
puts ' JVMCI_DIR_...git_branch_name... JMVCI repository to use for a given branch'
puts ' GRAAL_JS_JAR The location of trufflejs.jar'
puts ' SL_JAR The location of truffle-sl.jar'
puts ' SULONG_DIR The location of a built checkout of the Sulong repository'
puts ' SULONG_CLASSPATH An explicit classpath to use for Sulong, rather than working it out from SULONG_DIR'
end
@@ -571,6 +578,17 @@ def test_integration(env={}, *args)
jruby_opts = []

jruby_opts << '-Xtruffle.graal.warn_unless=false'

if ENV['GRAAL_JS_JAR']
jruby_opts << '-J-classpath'
jruby_opts << Utilities.find_graal_js
end

if ENV['SL_JAR']
jruby_opts << '-J-classpath'
jruby_opts << Utilities.find_sl
end

env_vars["JRUBY_OPTS"] = jruby_opts.join(' ')

env_vars["PATH"] = "#{Utilities.find_jruby_bin_dir}:#{ENV["PATH"]}"