aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2022-11-02 13:34:02 -0400
committerPeter Zhu <peter@peterzhu.ca>2022-11-02 13:34:02 -0400
commitb777408c33b57077f8be09eaed9245eeca0b59c5 (patch)
tree5a542125dae04f8fee61ad5908f9a643e7639705
parent81e84e0a4d348309d5d38311d283d049ffeeb7a2 (diff)
downloadruby-b777408c33b57077f8be09eaed9245eeca0b59c5.tar.gz
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.
-rw-r--r--tool/lib/test/unit.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb
index b2190843c8..59409f016c 100644
--- a/tool/lib/test/unit.rb
+++ b/tool/lib/test/unit.rb
@@ -787,7 +787,7 @@ module Test
unless rep.empty?
rep.each do |r|
if r[:error]
- puke(*r[:error], Timeout::Error)
+ puke(*r[:error], Timeout::Error.new)
next
end
r[:report]&.each do |f|
@@ -1742,6 +1742,9 @@ module Test
when Test::Unit::AssertionFailedError then
@failures += 1
"Failure:\n#{klass}##{meth} [#{location e}]:\n#{e.message}\n"
+ when Timeout::Error
+ @errors += 1
+ "Timeout:\n#{klass}##{meth}\n"
else
@errors += 1
bt = Test::filter_backtrace(e.backtrace).join "\n "