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

test_jit.rb: give up debugging cc1 issue

in a short term, and add retries to prevent random CI failures by it.

I remember this and will address it later for sure.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
k0kubun 2018-07-24 12:19:47 +00:00
parent afba9cd7fe
commit e8df28d9ae

View file

@ -730,19 +730,6 @@ class TestJIT < Test::Unit::TestCase
out, err = eval_with_jit(script, verbose: 1, min_calls: min_calls)
actual = err.scan(/^#{JIT_SUCCESS_PREFIX}:/).size
# Debugging on CI
if err.include?("error trying to exec 'cc1': execvp: No such file or directory") && RbConfig::CONFIG['CC'].start_with?('gcc')
$stderr.puts "\ntest/ruby/test_jit.rb: DEBUG OUTPUT:"
cc1 = %x`gcc -print-prog-name=cc1`.rstrip
if $?.success?
$stderr.puts "cc1 path: #{cc1}"
$stderr.puts "executable?: #{File.executable?(cc1)}"
$stderr.puts "ls:\n#{IO.popen(['ls', '-la', File.dirname(cc1)], &:read)}"
else
$stderr.puts 'Failed to fetch cc1 path'
end
end
# Make sure that the script has insns expected to be tested
used_insns = method_insns(script)
insns.each do |insn|
@ -799,11 +786,22 @@ class TestJIT < Test::Unit::TestCase
# Run Ruby script with --jit-wait (Synchronous JIT compilation).
# Returns [stdout, stderr]
def eval_with_jit(env = nil, script, **opts)
stdout, stderr, status = super
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 = nil, nil
# retry 3 times while cc1 error happens.
3.times do |i|
stdout, stderr, status = super
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)}")
break unless retried_stderr?(stderr)
end
[stdout, stderr]
end
# We're retrying cc1 not found error on gcc, which should be solved in the future but ignored for now.
def retried_stderr?(stderr)
RbConfig::CONFIG['CC'].start_with?('gcc') &&
stderr.include?("error trying to exec 'cc1': execvp: No such file or directory")
end
def code_block(code)
"```\n#{code}\n```\n\n"
end