diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2021-12-27 22:22:09 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-27 22:22:09 -0800 |
commit | eb49aa311932665ce7ce67fb461e288f46b83c84 (patch) | |
tree | a24d683fa3b77a3b5a53aebb9adf586d3d498577 | |
parent | a6e5d70346adc84ffde2d1c153ffb5b39dd2d388 (diff) |
Fix test_rubyoptions for MinGW (#5363)
* Fix test_rubyoptions for MinGW
follows up a74a2f456ad549025861be80f50cc3f0dd6646dd
* Require jit_support
* Fix MinGW platform
* Handle MinGW UCRT
and fix the prefix
* Make it more robust
Notes
Notes:
Merged-By: k0kubun <takashikkbn@gmail.com>
-rw-r--r-- | test/lib/jit_support.rb | 5 | ||||
-rw-r--r-- | test/ruby/test_rubyoptions.rb | 4 | ||||
-rw-r--r-- | test/ruby/test_yjit.rb | 3 |
3 files changed, 9 insertions, 3 deletions
diff --git a/test/lib/jit_support.rb b/test/lib/jit_support.rb index 6ad68f75be..c7618e03a0 100644 --- a/test/lib/jit_support.rb +++ b/test/lib/jit_support.rb @@ -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. diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index 0f73eb1682..665d93fc16 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -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]) diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb index 6390ab4c01..41a6d50779 100644 --- a/test/ruby/test_yjit.rb +++ b/test/ruby/test_yjit.rb @@ -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) |