Skip to content

Commit

Permalink
Showing 7 changed files with 38 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -109,6 +109,9 @@ matrix:
- env: PHASE='-Prake -Dtask=test:mri:fullint'
- env: JT='test mri'
jdk: oraclejdk8
- env: JT='test gems' JAVA_OPTS="$JAVA_OPTS -Xmx512m" HAS_REDIS=true
- env: PHASE='-Pj2ee'
jdk: oraclejdk7
# NOTE: build seems to never start (waited for any to finish for more than a day) - probably a travis-ci bug
#- env: PHASE='-Pmain'
# sudo: required
1 change: 1 addition & 0 deletions spec/truffle/tags/language/predefined_tags.txt
Original file line number Diff line number Diff line change
@@ -6,3 +6,4 @@ slow:The predefined global constant ARGV contains Strings encoded in locale Enco
linux:Global variable $0 actually sets the program name
slow:Global variable $0 is the path given as the main script and the same as __FILE__
slow:Global variable $? is thread-local
fails:Global variable $0 is the path given as the main script and the same as __FILE__
3 changes: 3 additions & 0 deletions spec/truffle/truffle.mspec
Original file line number Diff line number Diff line change
@@ -78,6 +78,9 @@ class MSpecScript
set :capi, [
"spec/ruby/optional/capi",

# Global variables
"^spec/ruby/optional/capi/gc_spec.rb",

# Fixnum boundaries do not match
"^spec/ruby/optional/capi/bignum_spec.rb",

2 changes: 1 addition & 1 deletion test/truffle/cexts/xml/.jruby-cext-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
src: ext/xml/*.c
cflags: -I$LIBXML_HOME/include/libxml2
libs: $LIBXML_HOME/lib/libxml2.dylib
libs: $LIBXML_LIB_HOME/libxml2.so
out: lib/xml/xml.su
2 changes: 1 addition & 1 deletion test/truffle/cexts/xopenssl/.jruby-cext-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
src: ext/xopenssl/*.c
cflags: -I$OPENSSL_HOME/include
libs: $OPENSSL_HOME/lib/libssl.dylib
libs: $OPENSSL_LIB_HOME/libssl.so
out: lib/xopenssl/xopenssl.su
34 changes: 28 additions & 6 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -32,7 +32,12 @@
METRICS_REPS = 10

LIBXML_HOME = ENV['LIBXML_HOME'] = ENV['LIBXML_HOME'] || '/usr'
LIBXML_LIB_HOME = ENV['LIBXML_LIB_HOME'] = ENV['LIBXML_LIB_HOME'] || "#{LIBXML_HOME}/lib"

OPENSSL_HOME = ENV['OPENSSL_HOME'] = ENV['OPENSSL_HOME'] || '/usr'
OPENSSL_LIB_HOME = ENV['OPENSSL_LIB_HOME'] = ENV['OPENSSL_LIB_HOME'] || "#{OPENSSL_HOME}/lib"

MAC = `uname -a`.include?('Darwin')

# wait for sub-processes to handle the interrupt
trap(:INT) {}
@@ -265,6 +270,11 @@ def raw_sh(*args)
else
status = $? unless capture
$stderr.puts "FAILED (#{status}): #{printable_cmd(args)}"

if capture
$stderr.puts out
$stderr.puts err
end

if status && status.exitstatus
exit status.exitstatus
@@ -550,7 +560,6 @@ def run(*args)
v = Utilities.truffle_version
jruby_args << "-J-Xbootclasspath/a:#{M2_REPO}/com/oracle/truffle/truffle-debug/#{v}/truffle-debug-#{v}.jar"
jruby_args << "-J-Dtruffle.profiling.enabled=true"
jruby_args << "-Xtruffle.profiler=true"
end

if args.delete('--igv')
@@ -625,6 +634,12 @@ def cextc(cext_dir, *clang_opts)
config_libs = config['libs'] || ''
config_libs = `echo #{config_libs}`.strip
config_libs = config_libs.split(' ')

if MAC
config_libs.each do |lib|
lib['.so'] = '.dylib'
end
end

sulong_link '-o', out, *((config_libs.map { |l| ['-l', l] }).flatten), *lls
end
@@ -710,23 +725,29 @@ def test_compiler(*args)
private :test_compiler

def test_cexts(*args)
if MAC
so = 'dylib'
else
so = 'so'
end

# Test that we can compile and run some basic C code that uses libxml and openssl

clang '-S', '-emit-llvm', "-I#{LIBXML_HOME}/include/libxml2", 'test/truffle/cexts/xml/main.c', '-o', 'test/truffle/cexts/xml/main.ll'
out, _ = sulong_run("-l#{LIBXML_HOME}/lib/libxml2.dylib", 'test/truffle/cexts/xml/main.ll', {capture: true})
out, _ = sulong_run("-l#{LIBXML_LIB_HOME}/libxml2.#{so}", 'test/truffle/cexts/xml/main.ll', {capture: true})
raise unless out == "7\n"

clang '-S', '-emit-llvm', "-I#{OPENSSL_HOME}/include", 'test/truffle/cexts/xopenssl/main.c', '-o', 'test/truffle/cexts/xopenssl/main.ll'
out, _ = sulong_run("-l#{OPENSSL_HOME}/lib/libssl.dylib", 'test/truffle/cexts/xopenssl/main.ll', {capture: true})
out, _ = sulong_run("-l#{OPENSSL_LIB_HOME}/libssl.#{so}", 'test/truffle/cexts/xopenssl/main.ll', {capture: true})
raise unless out == "5d41402abc4b2a76b9719d911017c592\n"

# Test that we can run those same test when they're build as a .su and we load the code and libraries from that

sulong_link '-o', 'test/truffle/cexts/xml/main.su', '-l', "#{LIBXML_HOME}/lib/libxml2.dylib", 'test/truffle/cexts/xml/main.ll'
sulong_link '-o', 'test/truffle/cexts/xml/main.su', '-l', "#{LIBXML_LIB_HOME}/libxml2.#{so}", 'test/truffle/cexts/xml/main.ll'
out, _ = sulong_run('test/truffle/cexts/xml/main.su', {capture: true})
raise unless out == "7\n"

sulong_link '-o', 'test/truffle/cexts/xopenssl/main.su', '-l', "#{OPENSSL_HOME}/lib/libssl.dylib", 'test/truffle/cexts/xopenssl/main.ll'
sulong_link '-o', 'test/truffle/cexts/xopenssl/main.su', '-l', "#{OPENSSL_LIB_HOME}/libssl.#{so}", 'test/truffle/cexts/xopenssl/main.ll'
out, _ = sulong_run('test/truffle/cexts/xopenssl/main.su', {capture: true})
raise unless out == "5d41402abc4b2a76b9719d911017c592\n"

@@ -898,7 +919,8 @@ def test_specs(command, *args)
private :test_specs

def test_tck(*args)
mvn *args, '-Ptck'
env = {'JRUBY_BUILD_MORE_QUIET' => 'true'}
mvn env, *args, '-Ptck'
end
private :test_tck

2 changes: 1 addition & 1 deletion truffle/src/main/c/openssl/.jruby-cext-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
src: ./*.c
cflags: -I$OPENSSL_HOME/include
libs: $OPENSSL_HOME/lib/libssl.dylib
libs: $OPENSSL_LIB_HOME/libssl.so
out: ../../../../../lib/ruby/truffle/openssl/openssl.su

0 comments on commit de9147c

Please sign in to comment.