1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix test_rubyoptions for MinGW (#5363)

* Fix test_rubyoptions for MinGW

follows up a74a2f456a

* Require jit_support

* Fix MinGW platform

* Handle MinGW UCRT

and fix the prefix

* Make it more robust
This commit is contained in:
Takashi Kokubun 2021-12-27 22:22:09 -08:00 committed by GitHub
parent a6e5d70346
commit eb49aa3119
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2021-12-28 15:22:29 +09:00
Merged-By: k0kubun <takashikkbn@gmail.com>
3 changed files with 9 additions and 3 deletions

View file

@ -62,6 +62,11 @@ module JITSupport
end && !appveyor_pdb_corrupted? && !PENDING_RUBYCI_NICKNAMES.include?(ENV['RUBYCI_NICKNAME'])
end
def yjit_supported?
# e.g. x86_64-linux, x64-mswin64_140, x64-mingw32, x64-mingw-ucrt
RUBY_PLATFORM.match?(/^(x86_64|x64)-/)
end
# AppVeyor's Visual Studio 2013 / 2015 are known to spuriously generate broken pch / pdb, like:
# error C2859: c:\projects\ruby\x64-mswin_120\include\ruby-2.8.0\x64-mswin64_120\rb_mjit_header-2.8.0.pdb
# is not the pdb file that was used when this precompiled header was created, recreate the precompiled header.

View file

@ -233,7 +233,7 @@ class TestRubyOptions < Test::Unit::TestCase
%w(--version --jit --disable=jit),
%w(--version --enable=jit --disable=jit),
%w(--version --enable-jit --disable-jit),
] unless /^x86_64|mswin64/ =~ RUBY_PLATFORM),
] unless JITSupport.yjit_supported?),
].each do |args|
assert_in_out_err([env] + args) do |r, e|
assert_match(VERSION_PATTERN, r[0])
@ -251,7 +251,7 @@ class TestRubyOptions < Test::Unit::TestCase
%w(--version --jit),
%w(--version --enable=jit),
%w(--version --enable-jit),
] unless /^x86_64|mswin64/ =~ RUBY_PLATFORM),
] unless JITSupport.yjit_supported?),
].each do |args|
assert_in_out_err([env] + args) do |r, e|
assert_match(VERSION_PATTERN_WITH_JIT, r[0])

View file

@ -2,6 +2,7 @@
require 'test/unit'
require 'envutil'
require 'tmpdir'
require_relative '../lib/jit_support'
return unless defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled?
@ -29,7 +30,7 @@ class TestYJIT < Test::Unit::TestCase
%w(--version --disable=jit --yjit),
%w(--version --disable=jit --enable-jit),
%w(--version --disable=jit --enable=jit),
] if RUBY_PLATFORM.start_with?('x86_64-') && RUBY_PLATFORM !~ /mswin|mingw|msys/),
] if JITSupport.yjit_supported?),
].each do |version_args|
assert_in_out_err(version_args) do |stdout, stderr|
assert_equal(RUBY_DESCRIPTION, stdout.first)