summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2024-11-04 14:29:25 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2024-11-04 14:29:25 -0800
commite7c939aea1034a463226635e11117ade42cba4e4 (patch)
treef1fbbefd5d4ab22ee4dcec237c216a8fd778f99a
parent7446f7cdd103b129b8b750f577efd29e069176c0 (diff)
merge revision(s) 76ea5cde2a0f4834a5228104249b6b3346ddfc94: [Backport #20777]
Refactor RUBY_DESCRIPTION assertions in test_rubyoptions
-rw-r--r--test/-ext-/bug_reporter/test_bug_reporter.rb1
-rw-r--r--test/ruby/test_rubyoptions.rb16
-rw-r--r--version.c3
-rw-r--r--version.h2
4 files changed, 17 insertions, 5 deletions
diff --git a/test/-ext-/bug_reporter/test_bug_reporter.rb b/test/-ext-/bug_reporter/test_bug_reporter.rb
index fd043690ac..bcb830088c 100644
--- a/test/-ext-/bug_reporter/test_bug_reporter.rb
+++ b/test/-ext-/bug_reporter/test_bug_reporter.rb
@@ -7,6 +7,7 @@ class TestBugReporter < Test::Unit::TestCase
def test_bug_reporter_add
omit "flaky with RJIT" if JITSupport.rjit_enabled?
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?
expected_stderr = [
:*,
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 5fe8877666..6d80ec7a7b 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -8,7 +8,17 @@ require_relative '../lib/jit_support'
class TestRubyOptions < Test::Unit::TestCase
def self.rjit_enabled? = defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled?
- def self.yjit_enabled? = defined?(RubyVM::YJIT.enabled?) && RubyVM::YJIT.enabled?
+ def self.yjit_enabled? = defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled?
+
+ # 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
+ # worry about it. The flag itself is tested in its own test.
+ RUBY_DESCRIPTION =
+ if EnvUtil.invoke_ruby(["-v"], "", true, false)[0].include?("+PRISM")
+ ::RUBY_DESCRIPTION
+ else
+ ::RUBY_DESCRIPTION.sub(/\+PRISM /, '')
+ end
NO_JIT_DESCRIPTION =
if rjit_enabled?
@@ -149,14 +159,14 @@ class TestRubyOptions < Test::Unit::TestCase
/^jruby #{q[RUBY_ENGINE_VERSION]} \(#{q[RUBY_VERSION]}\).*? \[#{
q[RbConfig::CONFIG["host_os"]]}-#{q[RbConfig::CONFIG["host_cpu"]]}\]$/
else
- /^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? \[#{q[RUBY_PLATFORM]}\]$/
+ /^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? (\+PRISM )?\[#{q[RUBY_PLATFORM]}\]$/
end
private_constant :VERSION_PATTERN
VERSION_PATTERN_WITH_RJIT =
case RUBY_ENGINE
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
VERSION_PATTERN
end
diff --git a/version.c b/version.c
index e719a59da2..48b5be1b19 100644
--- a/version.c
+++ b/version.c
@@ -150,7 +150,8 @@ define_ruby_description(const char *const jit_opt)
sizeof(ruby_description)
+ rb_strlen_lit(YJIT_DESCRIPTION)
+ rb_strlen_lit(" +MN")
- ];
+ + rb_strlen_lit(" +PRISM")
+ ];
const char *const threads_opt = ruby_mn_threads_enabled ? " +MN" : "";
const char *const parser_opt = (*rb_ruby_prism_ptr()) ? " +PRISM" : "";
diff --git a/version.h b/version.h
index 04e3d8fba4..ec002fcd39 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 5
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 101
+#define RUBY_PATCHLEVEL 102
#include "ruby/version.h"
#include "ruby/internal/abi.h"