Dump all-thread backtraces when test parallel worker exceeds time limit
This commit is contained in:
parent
67cd95e68f
commit
062f85e141
Notes:
git
2024-08-06 12:11:59 +00:00
@ -406,10 +406,10 @@ module Test
|
|||||||
rescue IOError
|
rescue IOError
|
||||||
end
|
end
|
||||||
|
|
||||||
def quit
|
def quit(reason = :normal)
|
||||||
return if @io.closed?
|
return if @io.closed?
|
||||||
@quit_called = true
|
@quit_called = true
|
||||||
@io.puts "quit"
|
@io.puts "quit #{reason}"
|
||||||
rescue Errno::EPIPE => e
|
rescue Errno::EPIPE => e
|
||||||
warn "#{@pid}:#{@status.to_s.ljust(7)}:#{@file}: #{e.message}"
|
warn "#{@pid}:#{@status.to_s.ljust(7)}:#{@file}: #{e.message}"
|
||||||
end
|
end
|
||||||
@ -534,7 +534,7 @@ module Test
|
|||||||
next unless cond&.call(worker)
|
next unless cond&.call(worker)
|
||||||
begin
|
begin
|
||||||
Timeout.timeout(1) do
|
Timeout.timeout(1) do
|
||||||
worker.quit
|
worker.quit(cond ? :timeout : :normal)
|
||||||
end
|
end
|
||||||
rescue Errno::EPIPE
|
rescue Errno::EPIPE
|
||||||
rescue Timeout::Error
|
rescue Timeout::Error
|
||||||
|
@ -127,7 +127,18 @@ module Test
|
|||||||
else
|
else
|
||||||
_report "ready"
|
_report "ready"
|
||||||
end
|
end
|
||||||
when /^quit$/
|
when /^quit (.+?)$/, "quit"
|
||||||
|
if $1 == "timeout"
|
||||||
|
err = ["", "!!! worker #{$$} killed due to timeout:"]
|
||||||
|
Thread.list.each do |th|
|
||||||
|
err << "#{ th.inspect }:"
|
||||||
|
th.backtrace.each do |s|
|
||||||
|
err << " #{ s }"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
err << ""
|
||||||
|
$STDERR.puts err.join("\n")
|
||||||
|
end
|
||||||
_report "bye"
|
_report "bye"
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
@ -22,7 +22,7 @@ module TestParallel
|
|||||||
if @worker_pid && @worker_in
|
if @worker_pid && @worker_in
|
||||||
begin
|
begin
|
||||||
begin
|
begin
|
||||||
@worker_in.puts "quit"
|
@worker_in.puts "quit normal"
|
||||||
rescue IOError, Errno::EPIPE
|
rescue IOError, Errno::EPIPE
|
||||||
end
|
end
|
||||||
Timeout.timeout(2) do
|
Timeout.timeout(2) do
|
||||||
@ -136,7 +136,7 @@ module TestParallel
|
|||||||
|
|
||||||
def test_quit
|
def test_quit
|
||||||
Timeout.timeout(TIMEOUT) do
|
Timeout.timeout(TIMEOUT) do
|
||||||
@worker_in.puts "quit"
|
@worker_in.puts "quit normal"
|
||||||
assert_match(/^bye$/m,@worker_out.read)
|
assert_match(/^bye$/m,@worker_out.read)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user