mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
merge revision(s) 76ea5cde2a
: [Backport #20777]
Refactor RUBY_DESCRIPTION assertions in test_rubyoptions
This commit is contained in:
parent
7446f7cdd1
commit
e7c939aea1
4 changed files with 17 additions and 5 deletions
|
@ -7,6 +7,7 @@ class TestBugReporter < Test::Unit::TestCase
|
||||||
def test_bug_reporter_add
|
def test_bug_reporter_add
|
||||||
omit "flaky with RJIT" if JITSupport.rjit_enabled?
|
omit "flaky with RJIT" if JITSupport.rjit_enabled?
|
||||||
description = RUBY_DESCRIPTION
|
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 = [
|
||||||
:*,
|
:*,
|
||||||
|
|
|
@ -8,7 +8,17 @@ require_relative '../lib/jit_support'
|
||||||
|
|
||||||
class TestRubyOptions < Test::Unit::TestCase
|
class TestRubyOptions < Test::Unit::TestCase
|
||||||
def self.rjit_enabled? = defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled?
|
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 =
|
NO_JIT_DESCRIPTION =
|
||||||
if rjit_enabled?
|
if rjit_enabled?
|
||||||
|
@ -149,14 +159,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" : "";
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
||||||
#define RUBY_VERSION_TEENY 5
|
#define RUBY_VERSION_TEENY 5
|
||||||
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
#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/version.h"
|
||||||
#include "ruby/internal/abi.h"
|
#include "ruby/internal/abi.h"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue