mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parent
8684946b21
commit
66a64e6f16
2 changed files with 9 additions and 6 deletions
|
@ -7,6 +7,6 @@ describe "The -v command line option" do
|
|||
describe "when used alone" do
|
||||
it "prints version and ends" do
|
||||
ruby_exe(nil, args: '-v').should include(RUBY_DESCRIPTION)
|
||||
end
|
||||
end unless defined?(YJIT) && YJIT.enabled? # pending. not sure why MJIT doesn't need anything to fix this.
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||
NO_JIT_DESCRIPTION =
|
||||
if defined?(RubyVM::JIT) && RubyVM::JIT.enabled? # checking -DMJIT_FORCE_ENABLE
|
||||
RUBY_DESCRIPTION.sub(/\+JIT /, '')
|
||||
elsif defined?(YJIT.enabled?) && YJIT.enabled?
|
||||
elsif defined?(YJIT.enabled?) && YJIT.enabled? # checking -DYJIT_FORCE_ENABLE
|
||||
RUBY_DESCRIPTION.sub(/\+YJIT /, '')
|
||||
else
|
||||
RUBY_DESCRIPTION
|
||||
|
@ -146,7 +146,7 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||
assert_match(VERSION_PATTERN, r[0])
|
||||
if defined?(RubyVM::JIT) && RubyVM::JIT.enabled? && !mjit_force_enabled? # checking -DMJIT_FORCE_ENABLE
|
||||
assert_equal(NO_JIT_DESCRIPTION, r[0])
|
||||
elsif defined?(YJIT.enabled?) && YJIT.enabled?
|
||||
elsif defined?(YJIT.enabled?) && YJIT.enabled? && !yjit_force_enabled? # checking -DYJIT_FORCE_ENABLE
|
||||
assert_equal(NO_JIT_DESCRIPTION, r[0])
|
||||
else
|
||||
assert_equal(RUBY_DESCRIPTION, r[0])
|
||||
|
@ -210,10 +210,8 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||
env = {'RUBY_YJIT_ENABLE' => nil} # unset in children
|
||||
assert_in_out_err([env, '--version']) do |r, e|
|
||||
assert_match(VERSION_PATTERN, r[0])
|
||||
if defined?(RubyVM::JIT) && RubyVM::JIT.enabled? # checking -DMJIT_FORCE_ENABLE
|
||||
if defined?(RubyVM::JIT) && RubyVM::JIT.enabled? || defined?(YJIT.enabled?) && YJIT.enabled? # checking -D*JIT_FORCE_ENABLE
|
||||
assert_equal(EnvUtil.invoke_ruby(['-e', 'print RUBY_DESCRIPTION'], '', true).first, r[0])
|
||||
elsif defined?(YJIT.enabled?) && YJIT.enabled?
|
||||
assert_equal(NO_JIT_DESCRIPTION, r[0])
|
||||
else
|
||||
assert_equal(RUBY_DESCRIPTION, r[0])
|
||||
end
|
||||
|
@ -221,6 +219,7 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
return if RbConfig::CONFIG["MJIT_SUPPORT"] == 'no'
|
||||
return if yjit_force_enabled?
|
||||
|
||||
[
|
||||
%w(--version --jit --disable=jit),
|
||||
|
@ -1119,4 +1118,8 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||
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
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue