зеркало из https://github.com/github/ruby.git
Dump all-thread backtraces when test parallel worker exceeds time limit
This commit is contained in:
Родитель
67cd95e68f
Коммит
062f85e141
|
@ -406,10 +406,10 @@ module Test
|
|||
rescue IOError
|
||||
end
|
||||
|
||||
def quit
|
||||
def quit(reason = :normal)
|
||||
return if @io.closed?
|
||||
@quit_called = true
|
||||
@io.puts "quit"
|
||||
@io.puts "quit #{reason}"
|
||||
rescue Errno::EPIPE => e
|
||||
warn "#{@pid}:#{@status.to_s.ljust(7)}:#{@file}: #{e.message}"
|
||||
end
|
||||
|
@ -534,7 +534,7 @@ module Test
|
|||
next unless cond&.call(worker)
|
||||
begin
|
||||
Timeout.timeout(1) do
|
||||
worker.quit
|
||||
worker.quit(cond ? :timeout : :normal)
|
||||
end
|
||||
rescue Errno::EPIPE
|
||||
rescue Timeout::Error
|
||||
|
|
|
@ -127,7 +127,18 @@ module Test
|
|||
else
|
||||
_report "ready"
|
||||
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"
|
||||
exit
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ module TestParallel
|
|||
if @worker_pid && @worker_in
|
||||
begin
|
||||
begin
|
||||
@worker_in.puts "quit"
|
||||
@worker_in.puts "quit normal"
|
||||
rescue IOError, Errno::EPIPE
|
||||
end
|
||||
Timeout.timeout(2) do
|
||||
|
@ -136,7 +136,7 @@ module TestParallel
|
|||
|
||||
def test_quit
|
||||
Timeout.timeout(TIMEOUT) do
|
||||
@worker_in.puts "quit"
|
||||
@worker_in.puts "quit normal"
|
||||
assert_match(/^bye$/m,@worker_out.read)
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче