Skip to content

Commit e7c939a

Browse files
committed
merge revision(s) 76ea5cd: [Backport #20777]
Refactor RUBY_DESCRIPTION assertions in test_rubyoptions
1 parent 7446f7c commit e7c939a

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

test/-ext-/bug_reporter/test_bug_reporter.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class TestBugReporter < Test::Unit::TestCase
77
def test_bug_reporter_add
88
omit "flaky with RJIT" if JITSupport.rjit_enabled?
99
description = RUBY_DESCRIPTION
10+
description = description.sub(/\+PRISM /, '') unless EnvUtil.invoke_ruby(["-v"], "", true, false)[0].include?("+PRISM")
1011
description = description.sub(/\+RJIT /, '') unless JITSupport.rjit_force_enabled?
1112
expected_stderr = [
1213
:*,

test/ruby/test_rubyoptions.rb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@
88

99
class TestRubyOptions < Test::Unit::TestCase
1010
def self.rjit_enabled? = defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled?
11-
def self.yjit_enabled? = defined?(RubyVM::YJIT.enabled?) && RubyVM::YJIT.enabled?
11+
def self.yjit_enabled? = defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled?
12+
13+
# Here we're defining our own RUBY_DESCRIPTION without "+PRISM". We do this
14+
# here so that the various tests that reference RUBY_DESCRIPTION don't have to
15+
# worry about it. The flag itself is tested in its own test.
16+
RUBY_DESCRIPTION =
17+
if EnvUtil.invoke_ruby(["-v"], "", true, false)[0].include?("+PRISM")
18+
::RUBY_DESCRIPTION
19+
else
20+
::RUBY_DESCRIPTION.sub(/\+PRISM /, '')
21+
end
1222

1323
NO_JIT_DESCRIPTION =
1424
if rjit_enabled?
@@ -149,14 +159,14 @@ def test_debug
149159
/^jruby #{q[RUBY_ENGINE_VERSION]} \(#{q[RUBY_VERSION]}\).*? \[#{
150160
q[RbConfig::CONFIG["host_os"]]}-#{q[RbConfig::CONFIG["host_cpu"]]}\]$/
151161
else
152-
/^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? \[#{q[RUBY_PLATFORM]}\]$/
162+
/^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? (\+PRISM )?\[#{q[RUBY_PLATFORM]}\]$/
153163
end
154164
private_constant :VERSION_PATTERN
155165

156166
VERSION_PATTERN_WITH_RJIT =
157167
case RUBY_ENGINE
158168
when 'ruby'
159-
/^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? \+RJIT (\+MN )?\[#{q[RUBY_PLATFORM]}\]$/
169+
/^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? \+RJIT (\+MN )?(\+PRISM )?\[#{q[RUBY_PLATFORM]}\]$/
160170
else
161171
VERSION_PATTERN
162172
end

version.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ define_ruby_description(const char *const jit_opt)
150150
sizeof(ruby_description)
151151
+ rb_strlen_lit(YJIT_DESCRIPTION)
152152
+ rb_strlen_lit(" +MN")
153-
];
153+
+ rb_strlen_lit(" +PRISM")
154+
];
154155

155156
const char *const threads_opt = ruby_mn_threads_enabled ? " +MN" : "";
156157
const char *const parser_opt = (*rb_ruby_prism_ptr()) ? " +PRISM" : "";

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
1212
#define RUBY_VERSION_TEENY 5
1313
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
14-
#define RUBY_PATCHLEVEL 101
14+
#define RUBY_PATCHLEVEL 102
1515

1616
#include "ruby/version.h"
1717
#include "ruby/internal/abi.h"

0 commit comments

Comments
 (0)