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

ruby-changes:50192

From: k0kubun <ko1@a...>
Date: Thu, 8 Feb 2018 21:58:32 +0900 (JST)
Subject: [ruby-changes:50192] k0kubun:r62310 (trunk): test_jit.rb: check JIT support more conservatively

k0kubun	2018-02-08 21:58:27 +0900 (Thu, 08 Feb 2018)

  New Revision: 62310

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62310

  Log:
    test_jit.rb: check JIT support more conservatively

  Modified files:
    trunk/test/ruby/test_jit.rb
Index: test/ruby/test_jit.rb
===================================================================
--- test/ruby/test_jit.rb	(revision 62309)
+++ test/ruby/test_jit.rb	(revision 62310)
@@ -43,12 +43,12 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L43
 
   # Run Ruby script with --jit-wait (Synchronous JIT compilation).
   # Returns [stdout, stderr]
-  def eval_with_jit(script, verbose: 0, min_calls: 5)
+  def eval_with_jit(script, verbose: 0, min_calls: 5, timeout: JIT_TIMEOUT)
     stdout, stderr, status = EnvUtil.invoke_ruby(
       ['--disable-gems', '--jit-wait', "--jit-verbose=#{verbose}", "--jit-min-calls=#{min_calls}", '-e', script],
-      '', true, true, timeout: JIT_TIMEOUT,
+      '', true, true, timeout: timeout,
     )
-    assert_equal(true, status.success?, "Failed to run script with JIT:\n#{code_block(script)}")
+    assert_equal(true, status.success?, "Failed to run script with JIT:\n#{code_block(script)}\nstdout:\n#{code_block(stdout)}\nstderr:\n#{code_block(stderr)}")
     [stdout, stderr]
   end
 
@@ -61,7 +61,11 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L61
   def jit_supported?
     return @jit_supported if defined?(@jit_supported)
 
-    out = IO.popen("#{RbConfig::CONFIG['CC']} --version", err: [:child, :out], &:read)
-    @jit_supported = $?.success? && SUPPORTED_COMPILERS.any? { |cc| out.match(/\b#{Regexp.escape(cc)}\b/) }
+    begin
+      @jit_supported = eval_with_jit('proc {}.call', verbose: 1, min_calls: 1, timeout: 10)
+    rescue Timeout::Error
+      $stderr.puts "TestJIT: #jit_supported? check timed out"
+      @jit_supported = false
+    end
   end
 end

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

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