Refactor RUBY_DESCRIPTION assertions in test_rubyoptions
This commit is contained in:
parent
aa3030ac24
commit
76ea5cde2a
Notes:
git
2024-07-18 17:03:35 +00:00
@ -8,7 +8,8 @@ class TestBugReporter < Test::Unit::TestCase
|
|||||||
pend "macOS 15 beta is not working with this test" if /darwin/ =~ RUBY_PLATFORM && /15/ =~ `sw_vers -productVersion`
|
pend "macOS 15 beta is not working with this test" if /darwin/ =~ RUBY_PLATFORM && /15/ =~ `sw_vers -productVersion`
|
||||||
|
|
||||||
omit "flaky with RJIT" if JITSupport.rjit_enabled?
|
omit "flaky with RJIT" if JITSupport.rjit_enabled?
|
||||||
description = RUBY_DESCRIPTION.sub(/\+PRISM /, '')
|
description = RUBY_DESCRIPTION
|
||||||
|
description = description.sub(/\+PRISM /, '') unless EnvUtil.invoke_ruby(["-v"], "", true, false)[0].include?("+PRISM")
|
||||||
description = description.sub(/\+RJIT /, '') unless JITSupport.rjit_force_enabled?
|
description = description.sub(/\+RJIT /, '') unless JITSupport.rjit_force_enabled?
|
||||||
expected_stderr = [
|
expected_stderr = [
|
||||||
:*,
|
:*,
|
||||||
|
@ -13,7 +13,12 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||||||
# Here we're defining our own RUBY_DESCRIPTION without "+PRISM". We do this
|
# Here we're defining our own RUBY_DESCRIPTION without "+PRISM". We do this
|
||||||
# here so that the various tests that reference RUBY_DESCRIPTION don't have to
|
# here so that the various tests that reference RUBY_DESCRIPTION don't have to
|
||||||
# worry about it. The flag itself is tested in its own test.
|
# worry about it. The flag itself is tested in its own test.
|
||||||
RUBY_DESCRIPTION = ::RUBY_DESCRIPTION.sub(/\+PRISM /, '')
|
RUBY_DESCRIPTION =
|
||||||
|
if EnvUtil.invoke_ruby(["-v"], "", true, false)[0].include?("+PRISM")
|
||||||
|
::RUBY_DESCRIPTION
|
||||||
|
else
|
||||||
|
::RUBY_DESCRIPTION.sub(/\+PRISM /, '')
|
||||||
|
end
|
||||||
|
|
||||||
NO_JIT_DESCRIPTION =
|
NO_JIT_DESCRIPTION =
|
||||||
if rjit_enabled?
|
if rjit_enabled?
|
||||||
@ -163,14 +168,14 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||||||
/^jruby #{q[RUBY_ENGINE_VERSION]} \(#{q[RUBY_VERSION]}\).*? \[#{
|
/^jruby #{q[RUBY_ENGINE_VERSION]} \(#{q[RUBY_VERSION]}\).*? \[#{
|
||||||
q[RbConfig::CONFIG["host_os"]]}-#{q[RbConfig::CONFIG["host_cpu"]]}\]$/
|
q[RbConfig::CONFIG["host_os"]]}-#{q[RbConfig::CONFIG["host_cpu"]]}\]$/
|
||||||
else
|
else
|
||||||
/^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? \[#{q[RUBY_PLATFORM]}\]$/
|
/^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? (\+PRISM )?\[#{q[RUBY_PLATFORM]}\]$/
|
||||||
end
|
end
|
||||||
private_constant :VERSION_PATTERN
|
private_constant :VERSION_PATTERN
|
||||||
|
|
||||||
VERSION_PATTERN_WITH_RJIT =
|
VERSION_PATTERN_WITH_RJIT =
|
||||||
case RUBY_ENGINE
|
case RUBY_ENGINE
|
||||||
when 'ruby'
|
when 'ruby'
|
||||||
/^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? \+RJIT (\+MN )?\[#{q[RUBY_PLATFORM]}\]$/
|
/^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? \+RJIT (\+MN )?(\+PRISM )?\[#{q[RUBY_PLATFORM]}\]$/
|
||||||
else
|
else
|
||||||
VERSION_PATTERN
|
VERSION_PATTERN
|
||||||
end
|
end
|
||||||
|
@ -150,7 +150,8 @@ define_ruby_description(const char *const jit_opt)
|
|||||||
sizeof(ruby_description)
|
sizeof(ruby_description)
|
||||||
+ rb_strlen_lit(YJIT_DESCRIPTION)
|
+ rb_strlen_lit(YJIT_DESCRIPTION)
|
||||||
+ rb_strlen_lit(" +MN")
|
+ rb_strlen_lit(" +MN")
|
||||||
];
|
+ rb_strlen_lit(" +PRISM")
|
||||||
|
];
|
||||||
|
|
||||||
const char *const threads_opt = ruby_mn_threads_enabled ? " +MN" : "";
|
const char *const threads_opt = ruby_mn_threads_enabled ? " +MN" : "";
|
||||||
const char *const parser_opt = (*rb_ruby_prism_ptr()) ? " +PRISM" : "";
|
const char *const parser_opt = (*rb_ruby_prism_ptr()) ? " +PRISM" : "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user