summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-08 12:58:27 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-08 12:58:27 +0000
commit7e57ff99e556622ed406e8fd2ee84280ade99cf6 (patch)
tree424307ee4315fdeea122a269c41ec6b78845e3a5 /test/ruby
parent0468f13606e6f78d9513926abd97d76512b9d7a7 (diff)
test_jit.rb: check JIT support more conservatively
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_jit.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb
index e981562c73..2257064d7b 100644
--- a/test/ruby/test_jit.rb
+++ b/test/ruby/test_jit.rb
@@ -43,12 +43,12 @@ class TestJIT < Test::Unit::TestCase
# 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
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