ruby-changes:63910
From: Benoit <ko1@a...>
Date: Sat, 5 Dec 2020 00:46:11 +0900 (JST)
Subject: [ruby-changes:63910] b4ec4a41c2 (master): Guard all accesses to RubyVM::MJIT with defined?(RubyVM::MJIT) &&
https://git.ruby-lang.org/ruby.git/commit/?id=b4ec4a41c2 From b4ec4a41c24105efbb43f9b70ca7f36d22f98294 Mon Sep 17 00:00:00 2001 From: Benoit Daloze <eregontp@g...> Date: Fri, 4 Dec 2020 16:40:02 +0100 Subject: Guard all accesses to RubyVM::MJIT with defined?(RubyVM::MJIT) && * Otherwise those tests, etc cannot run on alternative Ruby implementations. diff --git a/benchmark/lib/benchmark_driver/runner/mjit_exec.rb b/benchmark/lib/benchmark_driver/runner/mjit_exec.rb index 9f7c8c8..eac3dfb 100644 --- a/benchmark/lib/benchmark_driver/runner/mjit_exec.rb +++ b/benchmark/lib/benchmark_driver/runner/mjit_exec.rb @@ -135,7 +135,7 @@ class BenchmarkDriver::Runner::MjitExec https://github.com/ruby/ruby/blob/trunk/benchmark/lib/benchmark_driver/runner/mjit_exec.rb#L135 nil end % end - RubyVM::MJIT.pause if RubyVM::MJIT.enabled? + RubyVM::MJIT.pause if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? def vm t = Process.clock_gettime(Process::CLOCK_MONOTONIC) @@ -172,7 +172,7 @@ class BenchmarkDriver::Runner::MjitExec https://github.com/ruby/ruby/blob/trunk/benchmark/lib/benchmark_driver/runner/mjit_exec.rb#L172 a<%= i %> a<%= i %> # --jit-min-calls=2 % end - RubyVM::MJIT.pause if RubyVM::MJIT.enabled? + RubyVM::MJIT.pause if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? def vm t = Process.clock_gettime(Process::CLOCK_MONOTONIC) @@ -228,7 +228,7 @@ class BenchmarkDriver::Runner::MjitExec https://github.com/ruby/ruby/blob/trunk/benchmark/lib/benchmark_driver/runner/mjit_exec.rb#L228 jit jit - RubyVM::MJIT.pause if RubyVM::MJIT.enabled? + RubyVM::MJIT.pause if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? File.write(<%= result.dump %>, jit) EOS end diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb index 94a90f5..334d7a6 100755 --- a/bootstraptest/runner.rb +++ b/bootstraptest/runner.rb @@ -383,8 +383,8 @@ def assert_normal_exit(testsrc, *rest, timeout: nil, **opt) https://github.com/ruby/ruby/blob/trunk/bootstraptest/runner.rb#L383 end def assert_finish(timeout_seconds, testsrc, message = '') - if RubyVM.const_defined? :MJIT - timeout_seconds *= 3 if RubyVM::MJIT.enabled? # for --jit-wait + if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait + timeout_seconds *= 3 end newtest show_progress(message) { diff --git a/test/-ext-/bug_reporter/test_bug_reporter.rb b/test/-ext-/bug_reporter/test_bug_reporter.rb index 628fcd0..6b8e175 100644 --- a/test/-ext-/bug_reporter/test_bug_reporter.rb +++ b/test/-ext-/bug_reporter/test_bug_reporter.rb @@ -7,7 +7,7 @@ class TestBugReporter < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/-ext-/bug_reporter/test_bug_reporter.rb#L7 skip if ENV['RUBY_ON_BUG'] description = RUBY_DESCRIPTION - description = description.sub(/\+JIT /, '') if RubyVM::MJIT.enabled? + description = description.sub(/\+JIT /, '') if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? expected_stderr = [ :*, /\[BUG\]\sSegmentation\sfault.*\n/, diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb index c9e768a..16ffec9 100644 --- a/test/drb/drbtest.rb +++ b/test/drb/drbtest.rb @@ -216,7 +216,7 @@ module DRbCore https://github.com/ruby/ruby/blob/trunk/test/drb/drbtest.rb#L216 def test_06_timeout skip if RUBY_PLATFORM.include?("armv7l-linux") skip if RUBY_PLATFORM.include?("sparc-solaris2.10") - skip if RubyVM::MJIT.enabled? # expecting a certain delay is difficult for --jit-wait CI + skip if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # expecting a certain delay is difficult for --jit-wait CI Timeout.timeout(60) do ten = Onecky.new(10) assert_raise(Timeout::Error) do diff --git a/test/lib/jit_support.rb b/test/lib/jit_support.rb index e2bc766..2f6d637 100644 --- a/test/lib/jit_support.rb +++ b/test/lib/jit_support.rb @@ -74,7 +74,7 @@ module JITSupport https://github.com/ruby/ruby/blob/trunk/test/lib/jit_support.rb#L74 end def remove_mjit_logs(stderr) - if RubyVM::MJIT.enabled? # utility for -DFORCE_MJIT_ENABLE + if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # utility for -DFORCE_MJIT_ENABLE stderr.gsub(/^MJIT warning: Skipped to compile unsupported instruction: \w+\n/m, '') else stderr diff --git a/test/net/ftp/test_ftp.rb b/test/net/ftp/test_ftp.rb index 0907df5..023e794 100644 --- a/test/net/ftp/test_ftp.rb +++ b/test/net/ftp/test_ftp.rb @@ -762,7 +762,7 @@ class FTPTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L762 begin begin ftp = Net::FTP.new - ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait + ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait ftp.connect(SERVER_ADDR, server.port) ftp.login assert_match(/\AUSER /, commands.shift) @@ -807,7 +807,7 @@ class FTPTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L807 begin begin ftp = Net::FTP.new - ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait + ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait ftp.connect(SERVER_ADDR, server.port) ftp.login assert_match(/\AUSER /, commands.shift) @@ -1545,7 +1545,7 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L1545 begin begin ftp = Net::FTP.new - ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait + ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait ftp.connect(SERVER_ADDR, server.port) assert_equal(['LANG EN*', 'UTF8'], ftp.features) assert_equal("FEAT\r\n", commands.shift) @@ -1568,7 +1568,7 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L1568 begin begin ftp = Net::FTP.new - ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait + ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait ftp.connect(SERVER_ADDR, server.port) assert_raise(Net::FTPPermError) do ftp.features @@ -1594,7 +1594,7 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L1594 begin begin ftp = Net::FTP.new - ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait + ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait ftp.connect(SERVER_ADDR, server.port) ftp.option("UTF8", "ON") assert_equal("OPTS UTF8 ON\r\n", commands.shift) @@ -1653,7 +1653,7 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L1653 begin begin ftp = Net::FTP.new - ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait + ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait ftp.connect(SERVER_ADDR, server.port) entry = ftp.mlst("foo") assert_equal("/foo", entry.pathname) @@ -1740,7 +1740,7 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L1740 begin begin ftp = Net::FTP.new - ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait + ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait ftp.connect(SERVER_ADDR, server.port) ftp.login assert_match(/\AUSER /, commands.shift) @@ -1779,7 +1779,7 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L1779 def test_parse257 ftp = Net::FTP.new - ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait + ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait assert_equal('/foo/bar', ftp.send(:parse257, '257 "/foo/bar" directory created')) assert_equal('/foo/bar"baz', @@ -1918,7 +1918,7 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L1918 port: port, ssl: { ca_file: CA_FILE }, passive: false) - ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait + ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait begin assert_equal("AUTH TLS\r\n", commands.shift) assert_equal("PBSZ 0\r\n", commands.shift) @@ -2003,7 +2003,7 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L2003 port: port, ssl: { ca_file: CA_FILE }, passive: true) - ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait + ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait begin assert_equal("AUTH TLS\r\n", commands.shift) assert_equal("PBSZ 0\r\n", commands.shift) @@ -2079,7 +2079,7 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L2079 ssl: { ca_file: CA_FILE }, private_data_connection: false, passive: false) - ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait + ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait begin assert_equal("AUTH TLS\r\n", commands.shift) ftp.login @@ -2149,7 +2149,7 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L2149 ssl: { ca_file: CA_FILE }, private_data_connection: false, passive: true) - ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/