Skip to content

Commit 8af5ae8

Browse files
committed
Fix launcher specs when run with TRUFFLERUBYOPT=--native
(cherry picked from commit e8287b0)
1 parent 991f619 commit 8af5ae8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

spec/truffle/launcher_spec.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,20 @@ def should_print_full_java_command(options, env: {})
415415
TruffleRuby.graalvm_home and TruffleRuby.native?
416416
} do
417417
describe "runtime configuration flags" do
418+
before :each do
419+
@trufflerubyopt = ENV['TRUFFLERUBYOPT']
420+
# remove --native/--jvm from $TRUFFLERUBYOPT as they can conflict with command line arguments for these specs
421+
ENV['TRUFFLERUBYOPT'] = @trufflerubyopt.to_s.gsub(/--(native|jvm)\b/, '')
422+
end
423+
424+
after :each do
425+
ENV['TRUFFLERUBYOPT'] = @trufflerubyopt
426+
end
427+
418428
['RUBYOPT', 'TRUFFLERUBYOPT'].each do |var|
419429
it "should recognize ruby --vm options in #{var} when switching to JVM" do
420-
out = ruby_exe('puts RUBY_DESCRIPTION; puts Truffle::System.get_java_property("foo")', env: { var => "--jvm --vm.Dfoo=bar" }, args: @redirect)
430+
env = { var => "--jvm --vm.Dfoo=bar" }
431+
out = ruby_exe('puts RUBY_DESCRIPTION; puts Truffle::System.get_java_property("foo")', env: env, args: @redirect)
421432
check_status_and_empty_stderr
422433
out = out.lines.map(&:chomp)
423434
out[0].should =~ /GraalVM (CE|EE) JVM/

0 commit comments

Comments
 (0)