[前][次][番号順一覧][スレッド一覧]

ruby-changes:70630

From: Takashi <ko1@a...>
Date: Tue, 28 Dec 2021 15:22:24 +0900 (JST)
Subject: [ruby-changes:70630] eb49aa3119 (master): Fix test_rubyoptions for MinGW (#5363)

https://git.ruby-lang.org/ruby.git/commit/?id=eb49aa3119

From eb49aa311932665ce7ce67fb461e288f46b83c84 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Mon, 27 Dec 2021 22:22:09 -0800
Subject: 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
---
 test/lib/jit_support.rb       | 5 +++++
 test/ruby/test_rubyoptions.rb | 4 ++--
 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 6ad68f75be3..c7618e03a08 100644
--- a/test/lib/jit_support.rb
+++ b/test/lib/jit_support.rb
@@ -62,6 +62,11 @@ module JITSupport https://github.com/ruby/ruby/blob/trunk/test/lib/jit_support.rb#L62
     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 0f73eb16826..665d93fc161 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -233,7 +233,7 @@ class TestRubyOptions < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L233
         %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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L251
           %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 6390ab4c011..41a6d50779c 100644
--- a/test/ruby/test_yjit.rb
+++ b/test/ruby/test_yjit.rb
@@ -2,6 +2,7 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_yjit.rb#L2
 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_yjit.rb#L30
         %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)
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]