aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/-ext-/bug_reporter/test_bug_reporter.rb2
-rw-r--r--test/lib/jit_support.rb4
-rw-r--r--test/ruby/test_rubyoptions.rb14
3 files changed, 11 insertions, 9 deletions
diff --git a/test/-ext-/bug_reporter/test_bug_reporter.rb b/test/-ext-/bug_reporter/test_bug_reporter.rb
index 6e955e2cbd..8e1121f908 100644
--- a/test/-ext-/bug_reporter/test_bug_reporter.rb
+++ b/test/-ext-/bug_reporter/test_bug_reporter.rb
@@ -1,12 +1,14 @@
# frozen_string_literal: false
require 'test/unit'
require 'tmpdir'
+require_relative '../../lib/jit_support'
class TestBugReporter < Test::Unit::TestCase
def test_bug_reporter_add
omit if ENV['RUBY_ON_BUG']
description = RUBY_DESCRIPTION
+ description = description.sub(/\+MJIT /, '') unless JITSupport.mjit_force_enabled?
expected_stderr = [
:*,
/\[BUG\]\sSegmentation\sfault.*\n/,
diff --git a/test/lib/jit_support.rb b/test/lib/jit_support.rb
index c7618e03a0..e607df4cab 100644
--- a/test/lib/jit_support.rb
+++ b/test/lib/jit_support.rb
@@ -96,4 +96,8 @@ module JITSupport
RbConfig::CONFIG['CC'].start_with?('gcc') &&
stderr.include?("error trying to exec 'cc1': execvp: No such file or directory")
end
+
+ def mjit_force_enabled?
+ "#{RbConfig::CONFIG['CFLAGS']} #{RbConfig::CONFIG['CPPFLAGS']}".match?(/(\A|\s)-D ?MJIT_FORCE_ENABLE\b/)
+ end
end
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 757cbcf41f..93ad73bccd 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -10,9 +10,9 @@ class TestRubyOptions < Test::Unit::TestCase
def self.yjit_enabled? = defined?(RubyVM::YJIT.enabled?) && RubyVM::YJIT.enabled?
NO_JIT_DESCRIPTION =
- if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # checking -DMJIT_FORCE_ENABLE
+ if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?
RUBY_DESCRIPTION.sub(/\+MJIT /, '')
- elsif yjit_enabled? # checking -DYJIT_FORCE_ENABLE
+ elsif yjit_enabled?
RUBY_DESCRIPTION.sub(/\+YJIT /, '')
else
RUBY_DESCRIPTION
@@ -148,7 +148,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? && !mjit_force_enabled? # checking -DMJIT_FORCE_ENABLE
+ if defined?(RubyVM::MJIT) && RubyVM::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])
@@ -257,7 +257,7 @@ class TestRubyOptions < Test::Unit::TestCase
].each do |args|
assert_in_out_err([env] + args) do |r, e|
assert_match(VERSION_PATTERN_WITH_JIT, r[0])
- if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # checking -DMJIT_FORCE_ENABLE
+ if JITSupport.mjit_force_enabled?
assert_equal(RUBY_DESCRIPTION, r[0])
else
assert_equal(EnvUtil.invoke_ruby([env, '--mjit', '-e', 'print RUBY_DESCRIPTION'], '', true).first, r[0])
@@ -740,7 +740,7 @@ class TestRubyOptions < Test::Unit::TestCase
-e:(?:1:)?\s\[BUG\]\sSegmentation\sfault.*\n
)x,
%r(
- #{ Regexp.quote(RUBY_DESCRIPTION) }\n\n
+ #{ Regexp.quote(JITSupport.mjit_force_enabled? ? RUBY_DESCRIPTION : NO_JIT_DESCRIPTION) }\n\n
)x,
%r(
(?:--\s(?:.+\n)*\n)?
@@ -1132,10 +1132,6 @@ class TestRubyOptions < Test::Unit::TestCase
private
- def mjit_force_enabled?
- "#{RbConfig::CONFIG['CFLAGS']} #{RbConfig::CONFIG['CPPFLAGS']}".match?(/(\A|\s)-D ?MJIT_FORCE_ENABLE\b/)
- end
-
def yjit_force_enabled?
"#{RbConfig::CONFIG['CFLAGS']} #{RbConfig::CONFIG['CPPFLAGS']}".match?(/(\A|\s)-D ?YJIT_FORCE_ENABLE\b/)
end