Skip to content

Commit

Permalink
[GR-48237] Backports for 23.1 batch 3
Browse files Browse the repository at this point in the history
PullRequest: truffleruby/3992
  • Loading branch information
eregon committed Sep 5, 2023
2 parents 3a9693b + eed858a commit bf1b40d
Show file tree
Hide file tree
Showing 26 changed files with 109 additions and 103 deletions.
1 change: 1 addition & 0 deletions mx.truffleruby/native
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DYNAMIC_IMPORTS=/tools,/compiler,/substratevm
COMPONENTS=TruffleRuby,suite:tools,GraalVM compiler,SubstrateVM,Truffle Macro
NATIVE_IMAGES=suite:sulong,lib:rubyvm
EXTRA_IMAGE_BUILDER_ARGUMENTS=rubyvm:-H:+UnlockExperimentalVMOptions rubyvm:-H:BuildOutputJSONFile=native-image-build-rubyvm.json rubyvm:-H:-UnlockExperimentalVMOptions
GENERATE_DEBUGINFO=false
# To also create the standalone
INSTALLABLES=TruffleRuby
BUILD_TARGETS=GRAALVM,GRAALVM_STANDALONES
1 change: 1 addition & 0 deletions mx.truffleruby/native-ee
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DYNAMIC_IMPORTS=/tools,/truffleruby-enterprise,/graal-enterprise,/substratevm-en
COMPONENTS=TruffleRuby,suite:tools,GraalVM enterprise compiler,Truffle enterprise,SubstrateVM Enterprise,Truffle Macro Enterprise,suite:substratevm-enterprise-gcs
NATIVE_IMAGES=suite:sulong,lib:rubyvm
EXTRA_IMAGE_BUILDER_ARGUMENTS=rubyvm:-H:+UnlockExperimentalVMOptions rubyvm:-H:BuildOutputJSONFile=native-image-build-rubyvm.json rubyvm:-H:-UnlockExperimentalVMOptions
GENERATE_DEBUGINFO=false
# To also create the standalone
INSTALLABLES=TruffleRuby
BUILD_TARGETS=GRAALVM,GRAALVM_STANDALONES
1 change: 1 addition & 0 deletions mx.truffleruby/native-ee-aux
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DYNAMIC_IMPORTS=/tools,/truffleruby-enterprise,/graal-enterprise,/substratevm-en
COMPONENTS=TruffleRuby,suite:tools,GraalVM enterprise compiler,Truffle enterprise,SubstrateVM Enterprise,Truffle Macro Enterprise
NATIVE_IMAGES=suite:sulong,lib:rubyvm
EXTRA_IMAGE_BUILDER_ARGUMENTS=rubyvm:-H:+UnlockExperimentalVMOptions rubyvm:-H:BuildOutputJSONFile=native-image-build-rubyvm.json rubyvm:-H:-UnlockExperimentalVMOptions rubyvm:-H:+AuxiliaryEngineCache rubyvm:-H:ReservedAuxiliaryImageBytes=1073741824
GENERATE_DEBUGINFO=false
NATIVE_IMAGE_AUXILIARY_ENGINE_CACHE=true
# To also create the standalone
INSTALLABLES=TruffleRuby
Expand Down
1 change: 1 addition & 0 deletions mx.truffleruby/native-host-inlining
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DYNAMIC_IMPORTS=/tools,/compiler,/substratevm
COMPONENTS=TruffleRuby,suite:tools,GraalVM compiler,SubstrateVM,Truffle Macro
NATIVE_IMAGES=lib:rubyvm
EXTRA_IMAGE_BUILDER_ARGUMENTS=rubyvm:-H:+UnlockExperimentalVMOptions rubyvm:-H:BuildOutputJSONFile=native-image-build-rubyvm.json rubyvm:-H:Log=HostInliningPhase,~CanonicalizerPhase,~GraphBuilderPhase rubyvm:-H:+TruffleHostInliningPrintExplored rubyvm:-H:-UnlockExperimentalVMOptions rubyvm:-Dgraal.LogFile=host-inlining.txt
GENERATE_DEBUGINFO=false
# To also create the standalone
INSTALLABLES=TruffleRuby
BUILD_TARGETS=GRAALVM,GRAALVM_STANDALONES
22 changes: 4 additions & 18 deletions mx.truffleruby/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
"requires": ["java.management"],
"dependencies": [
"truffleruby:TRUFFLERUBY-ANNOTATIONS",
"sdk:GRAAL_SDK",
"sdk:POLYGLOT",
],
"annotationProcessors": [
"TRUFFLERUBY-PROCESSOR",
Expand Down Expand Up @@ -207,20 +207,6 @@
"license": ["EPL-2.0"],
},

"org.truffleruby.services": {
"dir": "src/services",
"sourceDirs": ["java"],
"requires": ["java.scripting"],
"dependencies": [
"sdk:GRAAL_SDK",
],
"jacoco": "include",
"javaCompliance": "17+",
"checkstyle": "org.truffleruby",
"workingSets": "TruffleRuby",
"license": ["EPL-2.0"],
},

"org.truffleruby.rubysignal": {
"dir": "src/main/c/rubysignal",
"native": "shared_lib",
Expand Down Expand Up @@ -325,7 +311,7 @@
"dependencies": [
"truffleruby:TRUFFLERUBY-ANNOTATIONS",
"truffleruby:TRUFFLERUBY-SHARED",
"sdk:GRAAL_SDK",
"sdk:POLYGLOT",
"sdk:LAUNCHER_COMMON",
],
"jacoco": "include",
Expand Down Expand Up @@ -468,7 +454,7 @@
],
"distDependencies": [
"truffleruby:TRUFFLERUBY-ANNOTATIONS",
"sdk:GRAAL_SDK",
"sdk:POLYGLOT",
],
"description": "TruffleRuby Shared constants and predicates",
"license": ["EPL-2.0"],
Expand Down Expand Up @@ -578,7 +564,7 @@
"distDependencies": [
"truffleruby:TRUFFLERUBY-ANNOTATIONS",
"truffleruby:TRUFFLERUBY-SHARED",
"sdk:GRAAL_SDK",
"sdk:POLYGLOT",
"sdk:LAUNCHER_COMMON",
],
"description": "TruffleRuby Launcher",
Expand Down
4 changes: 3 additions & 1 deletion spec/mspec/tool/tag_from_output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Adds tags based on error and failures output (e.g., from a CI log),
# without running any spec code.

tag = ENV["TAG"] || "fails"

tags_dir = %w[
spec/tags
spec/tags/ruby
Expand Down Expand Up @@ -54,7 +56,7 @@
dir = File.dirname(tags_file)
Dir.mkdir(dir) unless Dir.exist?(dir)

tag_line = "fails:#{description}"
tag_line = "#{tag}:#{description}"
lines = File.exist?(tags_file) ? File.readlines(tags_file, chomp: true) : []
unless lines.include?(tag_line)
puts tags_file
Expand Down
4 changes: 2 additions & 2 deletions spec/ruby/command_line/dash_a_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
end

it "runs the code in loop conditional on Kernel.gets()" do
ruby_exe("puts $F.last", options: "-n -a", escape: true,
ruby_exe("puts $F.last", options: "-n -a",
args: " < #{@names}").should ==
"jones\nfield\ngrey\n"
end

it "sets $-a" do
ruby_exe("puts $-a", options: "-n -a", escape: true,
ruby_exe("puts $-a", options: "-n -a",
args: " < #{@names}").should ==
"true\ntrue\ntrue\n"
end
Expand Down
8 changes: 4 additions & 4 deletions spec/ruby/command_line/dash_l_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
end

it "chomps lines with default separator" do
ruby_exe('puts $_.end_with?("\n")', options: "-n -l", escape: true,
ruby_exe('puts $_.end_with?("\n")', options: "-n -l",
args: " < #{@names}").should ==
"false\nfalse\nfalse\n"
end

it "chomps last line based on $/" do
ruby_exe('BEGIN { $/ = "ones\n" }; puts $_', options: "-W0 -n -l", escape: true,
ruby_exe('BEGIN { $/ = "ones\n" }; puts $_', options: "-W0 -n -l",
args: " < #{@names}").should ==
"alice j\nbob field\njames grey\n"
end

it "sets $\\ to the value of $/" do
ruby_exe("puts $\\ == $/", options: "-W0 -n -l", escape: true,
ruby_exe("puts $\\ == $/", options: "-W0 -n -l",
args: " < #{@names}").should ==
"true\ntrue\ntrue\n"
end

it "sets $-l" do
ruby_exe("puts $-l", options: "-n -l", escape: true,
ruby_exe("puts $-l", options: "-n -l",
args: " < #{@names}").should ==
"true\ntrue\ntrue\n"
end
Expand Down
8 changes: 4 additions & 4 deletions spec/ruby/command_line/dash_n_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
end

it "runs the code in loop conditional on Kernel.gets()" do
ruby_exe("puts $_", options: "-n", escape: true,
ruby_exe("puts $_", options: "-n",
args: " < #{@names}").should ==
"alice\nbob\njames\n"
end

it "only evaluates BEGIN blocks once" do
ruby_exe("BEGIN { puts \"hi\" }; puts $_", options: "-n", escape: true,
ruby_exe("BEGIN { puts \"hi\" }; puts $_", options: "-n",
args: " < #{@names}").should ==
"hi\nalice\nbob\njames\n"
end

it "only evaluates END blocks once" do
ruby_exe("puts $_; END {puts \"bye\"}", options: "-n", escape: true,
ruby_exe("puts $_; END {puts \"bye\"}", options: "-n",
args: " < #{@names}").should ==
"alice\nbob\njames\nbye\n"
end
Expand All @@ -29,7 +29,7 @@
$total += 1
END { puts $total }
script
ruby_exe(script, options: "-n", escape: true,
ruby_exe(script, options: "-n",
args: " < #{@names}").should ==
"3\n"
end
Expand Down
4 changes: 2 additions & 2 deletions spec/ruby/command_line/dash_p_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
end

it "runs the code in loop conditional on Kernel.gets() and prints $_" do
ruby_exe("$_ = $_.upcase", options: "-p", escape: true,
ruby_exe("$_ = $_.upcase", options: "-p",
args: " < #{@names}").should ==
"ALICE\nBOB\nJAMES\n"
end

it "sets $-p" do
ruby_exe("$_ = $-p", options: "-p", escape: true,
ruby_exe("$_ = $-p", options: "-p",
args: " < #{@names}").should ==
"truetruetrue"
end
Expand Down
2 changes: 1 addition & 1 deletion spec/ruby/command_line/dash_upper_f_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
end

it "specifies the field separator pattern for -a" do
ruby_exe("puts $F[0]", options: "-naF:", escape: true,
ruby_exe("puts $F[0]", options: "-naF:",
args: " < #{@passwd}").should ==
"nobody\nroot\ndaemon\n"
end
Expand Down
14 changes: 7 additions & 7 deletions spec/ruby/command_line/rubyopt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

it "adds the -I path to $LOAD_PATH" do
ENV["RUBYOPT"] = "-Ioptrubyspecincl"
result = ruby_exe("puts $LOAD_PATH.grep(/byspecin/)", escape: true)
result = ruby_exe("puts $LOAD_PATH.grep(/byspecin/)")
result.chomp[-15..-1].should == "optrubyspecincl"
end

it "sets $DEBUG to true for '-d'" do
ENV["RUBYOPT"] = '-d'
command = %[puts "value of $DEBUG is \#{$DEBUG}"]
result = ruby_exe(command, escape: true, args: "2>&1")
result = ruby_exe(command, args: "2>&1")
result.should =~ /value of \$DEBUG is true/
end

Expand All @@ -36,27 +36,27 @@

it "sets $VERBOSE to true for '-w'" do
ENV["RUBYOPT"] = '-w'
ruby_exe("p $VERBOSE", escape: true).chomp.should == "true"
ruby_exe("p $VERBOSE").chomp.should == "true"
end

it "sets $VERBOSE to true for '-W'" do
ENV["RUBYOPT"] = '-W'
ruby_exe("p $VERBOSE", escape: true).chomp.should == "true"
ruby_exe("p $VERBOSE").chomp.should == "true"
end

it "sets $VERBOSE to nil for '-W0'" do
ENV["RUBYOPT"] = '-W0'
ruby_exe("p $VERBOSE", escape: true).chomp.should == "nil"
ruby_exe("p $VERBOSE").chomp.should == "nil"
end

it "sets $VERBOSE to false for '-W1'" do
ENV["RUBYOPT"] = '-W1'
ruby_exe("p $VERBOSE", escape: true).chomp.should == "false"
ruby_exe("p $VERBOSE").chomp.should == "false"
end

it "sets $VERBOSE to true for '-W2'" do
ENV["RUBYOPT"] = '-W2'
ruby_exe("p $VERBOSE", escape: true).chomp.should == "true"
ruby_exe("p $VERBOSE").chomp.should == "true"
end

it "suppresses deprecation warnings for '-W:no-deprecated'" do
Expand Down
2 changes: 1 addition & 1 deletion spec/ruby/core/argf/readpartial_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
print ARGF.readpartial(#{@stdin.size})
ARGF.readpartial(1) rescue print $!.class
STR
stdin = ruby_exe(ruby_str, args: "< #{@stdin_name}", escape: true)
stdin = ruby_exe(ruby_str, args: "< #{@stdin_name}")
stdin.should == @stdin + "EOFError"
end
end
4 changes: 2 additions & 2 deletions spec/ruby/core/file/flock_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
it "returns false if trying to lock an exclusively locked file" do
@file.flock File::LOCK_EX

ruby_exe(<<-END_OF_CODE, escape: true).should == "false"
ruby_exe(<<-END_OF_CODE).should == "false"
File.open('#{@name}', "w") do |f2|
print f2.flock(File::LOCK_EX | File::LOCK_NB).to_s
end
Expand All @@ -40,7 +40,7 @@
it "blocks if trying to lock an exclusively locked file" do
@file.flock File::LOCK_EX

out = ruby_exe(<<-END_OF_CODE, escape: true)
out = ruby_exe(<<-END_OF_CODE)
running = false
t = Thread.new do
Expand Down
4 changes: 2 additions & 2 deletions spec/ruby/core/kernel/exec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
end

it "runs the specified command, replacing current process" do
ruby_exe('exec "echo hello"; puts "fail"', escape: true).should == "hello\n"
ruby_exe('exec "echo hello"; puts "fail"').should == "hello\n"
end
end

describe "Kernel.exec" do
it "runs the specified command, replacing current process" do
ruby_exe('Kernel.exec "echo hello"; puts "fail"', escape: true).should == "hello\n"
ruby_exe('Kernel.exec "echo hello"; puts "fail"').should == "hello\n"
end
end
Loading

0 comments on commit bf1b40d

Please sign in to comment.