Skip to content

Commit b777408

Browse files
committed
Fix crash in test runner on timeout
When a test worker hangs and timeouts, the test runner crashes with the following stack trace: ruby/tool/lib/test/unit.rb:1747:in `puke': undefined method `backtrace' for Timeout::Error:Class (NoMethodError) from ruby/tool/lib/test/unit.rb:790:in `block in _run_parallel' from ruby/tool/lib/test/unit.rb:788:in `each' This commit adds handling for Timeout::Error and outputs a message.
1 parent 81e84e0 commit b777408

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tool/lib/test/unit.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ def _run_parallel suites, type, result
787787
unless rep.empty?
788788
rep.each do |r|
789789
if r[:error]
790-
puke(*r[:error], Timeout::Error)
790+
puke(*r[:error], Timeout::Error.new)
791791
next
792792
end
793793
r[:report]&.each do |f|
@@ -1742,6 +1742,9 @@ def puke klass, meth, e
17421742
when Test::Unit::AssertionFailedError then
17431743
@failures += 1
17441744
"Failure:\n#{klass}##{meth} [#{location e}]:\n#{e.message}\n"
1745+
when Timeout::Error
1746+
@errors += 1
1747+
"Timeout:\n#{klass}##{meth}\n"
17451748
else
17461749
@errors += 1
17471750
bt = Test::filter_backtrace(e.backtrace).join "\n "

0 commit comments

Comments
 (0)