Skip to content

Commit

Permalink
RJIT: Streamline RJIT enablement check
Browse files Browse the repository at this point in the history
in bootstrap tests so that `make btest-bruby` skips the right tests.
  • Loading branch information
k0kubun committed Dec 21, 2023
1 parent c73959c commit 78b27ce
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
5 changes: 5 additions & 0 deletions bootstraptest/runner.rb
Expand Up @@ -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
2 changes: 1 addition & 1 deletion bootstraptest/test_gc.rb
Expand Up @@ -14,7 +14,7 @@
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 = []
Expand Down
5 changes: 2 additions & 3 deletions bootstraptest/test_thread.rb
Expand Up @@ -293,7 +293,6 @@
exec "/"
}

rjit_enabled = RUBY_DESCRIPTION.include?('+RJIT')
assert_normal_exit %q{
(0..10).map {
Thread.new {
Expand All @@ -304,7 +303,7 @@
}.each {|t|
t.join
}
} unless rjit_enabled # flaky
} unless rjit_enabled? # flaky

assert_equal 'ok', %q{
def m
Expand Down Expand Up @@ -498,7 +497,7 @@ def m
[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
Expand Down
16 changes: 8 additions & 8 deletions bootstraptest/test_yjit.rb
Expand Up @@ -22,7 +22,7 @@ def test(args)
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{
Expand Down Expand Up @@ -81,7 +81,7 @@ def foo = yield
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{
Expand Down Expand Up @@ -209,7 +209,7 @@ def extender
# 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
Expand Down Expand Up @@ -1960,7 +1960,7 @@ def getbyte(s, i)
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{
Expand Down Expand Up @@ -2604,7 +2604,7 @@ def events.compiled(obj)
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{
Expand Down Expand Up @@ -2686,7 +2686,7 @@ def shouldnt_compile
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{
Expand All @@ -2701,7 +2701,7 @@ def shouldnt_compile
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{
Expand Down Expand Up @@ -4223,7 +4223,7 @@ def calling_func
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{
Expand Down

0 comments on commit 78b27ce

Please sign in to comment.