From 78b27ce62a7d6f28c73d6fb4f97b0948859be8e0 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Thu, 21 Dec 2023 14:30:55 -0800 Subject: [PATCH] RJIT: Streamline RJIT enablement check in bootstrap tests so that `make btest-bruby` skips the right tests. --- bootstraptest/runner.rb | 5 +++++ bootstraptest/test_gc.rb | 2 +- bootstraptest/test_thread.rb | 5 ++--- bootstraptest/test_yjit.rb | 16 ++++++++-------- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb index 6b5851e67a..a34527d2fa 100755 --- a/bootstraptest/runner.rb +++ b/bootstraptest/runner.rb @@ -789,4 +789,9 @@ def check_coredump end end +def rjit_enabled? + # Don't check `RubyVM::RJIT.enabled?`. On btest-bruby, target Ruby != runner Ruby. + ENV.fetch('RUN_OPTS', '').include?('rjit') +end + exit main diff --git a/bootstraptest/test_gc.rb b/bootstraptest/test_gc.rb index 9f17e14814..17bc497822 100644 --- a/bootstraptest/test_gc.rb +++ b/bootstraptest/test_gc.rb @@ -14,7 +14,7 @@ ms = "a".."k" o.send(meth) end end -}, '[ruby-dev:39453]' unless ENV.fetch('RUN_OPTS', '').include?('rjit') # speed up RJIT CI +}, '[ruby-dev:39453]' unless rjit_enabled? # speed up RJIT CI assert_normal_exit %q{ a = [] diff --git a/bootstraptest/test_thread.rb b/bootstraptest/test_thread.rb index 18b4fcd2e9..a4d46e2f10 100644 --- a/bootstraptest/test_thread.rb +++ b/bootstraptest/test_thread.rb @@ -293,7 +293,6 @@ assert_normal_exit %q{ exec "/" } -rjit_enabled = RUBY_DESCRIPTION.include?('+RJIT') assert_normal_exit %q{ (0..10).map { Thread.new { @@ -304,7 +303,7 @@ assert_normal_exit %q{ }.each {|t| t.join } -} unless rjit_enabled # flaky +} unless rjit_enabled? # flaky assert_equal 'ok', %q{ def m @@ -498,7 +497,7 @@ assert_equal 'foo', %q{ [th1, th2].each {|t| t.join } GC.start f.call.source -} unless rjit_enabled # flaky +} unless rjit_enabled? # flaky assert_normal_exit %q{ class C def inspect diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index b9c332b37a..379591641c 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -22,7 +22,7 @@ assert_equal '[:ae, :ae]', %q{ end [test(Array.new 5), test([])] -} unless defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # Not yet working on RJIT +} unless rjit_enabled? # Not yet working on RJIT # regression test for arity check with splat and send assert_equal '[:ae, :ae]', %q{ @@ -81,7 +81,7 @@ assert_equal 'ok', %q{ GC.compact end :ok -} unless defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # Not yet working on RJIT +} unless rjit_enabled? # Not yet working on RJIT # regression test for overly generous guard elision assert_equal '[0, :sum, 0, :sum]', %q{ @@ -209,7 +209,7 @@ assert_equal '[:ok]', %q{ # Used to crash due to GC run in rb_ensure_iv_list_size() # not marking the newly allocated [:ok]. RegressionTest.new.extender.itself -} unless RUBY_DESCRIPTION.include?('+RJIT') # Skip on RJIT since this uncovers a crash +} unless rjit_enabled? # Skip on RJIT since this uncovers a crash assert_equal 'true', %q{ # regression test for tracking type of locals for too long @@ -1960,7 +1960,7 @@ assert_equal '[97, :nil, 97, :nil, :raised]', %q{ getbyte("a", 0) [getbyte("a", 0), getbyte("a", 1), getbyte("a", -1), getbyte("a", -2), getbyte("a", "a")] -} unless defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # Not yet working on RJIT +} unless rjit_enabled? # Not yet working on RJIT # Test << operator on string subclass assert_equal 'abab', %q{ @@ -2604,7 +2604,7 @@ assert_equal '[[:c_return, :String, :string_alias, "events_to_str"]]', %q{ events.compiled(events) events -} unless defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # RJIT calls extra Ruby methods +} unless rjit_enabled? # RJIT calls extra Ruby methods # test enabling a TracePoint that targets a particular line in a C method call assert_equal '[true]', %q{ @@ -2686,7 +2686,7 @@ assert_equal '[[:c_call, :itself]]', %q{ tp.enable { shouldnt_compile } events -} unless defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # RJIT calls extra Ruby methods +} unless rjit_enabled? # RJIT calls extra Ruby methods # test enabling c_return tracing before compiling assert_equal '[[:c_return, :itself, main]]', %q{ @@ -2701,7 +2701,7 @@ assert_equal '[[:c_return, :itself, main]]', %q{ tp.enable { shouldnt_compile } events -} unless defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # RJIT calls extra Ruby methods +} unless rjit_enabled? # RJIT calls extra Ruby methods # test c_call invalidation assert_equal '[[:c_call, :itself]]', %q{ @@ -4223,7 +4223,7 @@ assert_equal 'true', %q{ rescue ArgumentError true end -} unless defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # Not yet working on RJIT +} unless rjit_enabled? # Not yet working on RJIT # Regresssion test: register allocator on expandarray assert_equal '[]', %q{