summaryrefslogtreecommitdiff
path: root/test/ruby/test_rubyoptions.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-07-10 23:58:18 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2022-07-10 23:58:19 -0700
commitfae568edbe61f816237aab230ced2ecc07135c45 (patch)
tree803e3d6a8fa5988e04e11b0e49a8fdbda3366933 /test/ruby/test_rubyoptions.rb
parent203801566a186b7b1cbe899a06d0832923a1bdf9 (diff)
downloadruby-fae568edbe61f816237aab230ced2ecc07135c45.tar.gz
Use NO_JIT_DESCRIPTION only when needed
Apparently 203801566a186b7b1cbe899a06d0832923a1bdf9 broke YJIT's CI.
Diffstat (limited to 'test/ruby/test_rubyoptions.rb')
-rw-r--r--test/ruby/test_rubyoptions.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 93ad73bccd..6d2c0fa5cd 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -7,10 +7,11 @@ require 'tempfile'
require_relative '../lib/jit_support'
class TestRubyOptions < Test::Unit::TestCase
+ def self.mjit_enabled? = defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?
def self.yjit_enabled? = defined?(RubyVM::YJIT.enabled?) && RubyVM::YJIT.enabled?
NO_JIT_DESCRIPTION =
- if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?
+ if mjit_enabled?
RUBY_DESCRIPTION.sub(/\+MJIT /, '')
elsif yjit_enabled?
RUBY_DESCRIPTION.sub(/\+YJIT /, '')
@@ -148,7 +149,7 @@ class TestRubyOptions < Test::Unit::TestCase
def test_verbose
assert_in_out_err([{'RUBY_YJIT_ENABLE' => nil}, "-vve", ""]) do |r, e|
assert_match(VERSION_PATTERN, r[0])
- if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? && !JITSupport.mjit_force_enabled?
+ if self.class.mjit_enabled? && !JITSupport.mjit_force_enabled?
assert_equal(NO_JIT_DESCRIPTION, r[0])
elsif self.class.yjit_enabled? && !yjit_force_enabled? # checking -DYJIT_FORCE_ENABLE
assert_equal(NO_JIT_DESCRIPTION, r[0])
@@ -216,7 +217,7 @@ class TestRubyOptions < Test::Unit::TestCase
assert_match(VERSION_PATTERN, r[0])
if ENV['RUBY_YJIT_ENABLE'] == '1'
assert_equal(NO_JIT_DESCRIPTION, r[0])
- elsif defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? || self.class.yjit_enabled? # checking -D(M|Y)JIT_FORCE_ENABLE
+ elsif self.class.mjit_enabled? || self.class.yjit_enabled? # checking -D(M|Y)JIT_FORCE_ENABLE
assert_equal(EnvUtil.invoke_ruby(['-e', 'print RUBY_DESCRIPTION'], '', true).first, r[0])
else
assert_equal(RUBY_DESCRIPTION, r[0])
@@ -740,7 +741,7 @@ class TestRubyOptions < Test::Unit::TestCase
-e:(?:1:)?\s\[BUG\]\sSegmentation\sfault.*\n
)x,
%r(
- #{ Regexp.quote(JITSupport.mjit_force_enabled? ? RUBY_DESCRIPTION : NO_JIT_DESCRIPTION) }\n\n
+ #{ Regexp.quote((TestRubyOptions.mjit_enabled? && !JITSupport.mjit_force_enabled?) ? NO_JIT_DESCRIPTION : RUBY_DESCRIPTION) }\n\n
)x,
%r(
(?:--\s(?:.+\n)*\n)?