Make test suites dump daemon stack on test timeout

Use `OnTimeout` callback on test timeouts to trigger a stack dump for
running daemons. This will help analyze stuck tests.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 82dd2c3159993fd32f4a8f27b92699a6287c215a
Component: engine
This commit is contained in:
Brian Goff
2016-07-27 14:17:44 -04:00
parent 2e4e3536cc
commit 1c05db53d1
5 changed files with 109 additions and 0 deletions

View File

@ -273,6 +273,16 @@ func (d *Daemon) Kill() error {
return nil
}
// DumpStackAndQuit sends SIGQUIT to the daemon, which triggers it to dump its
// stack to its log file and exit
// This is used primarily for gathering debug information on test timeout
func (d *Daemon) DumpStackAndQuit() {
if d.cmd == nil || d.cmd.Process == nil {
return
}
signalDaemonDump(d.cmd.Process.Pid)
}
// Stop will send a SIGINT every second and wait for the daemon to stop.
// If it timeouts, a SIGKILL is sent.
// Stop will not delete the daemon directory. If a purged daemon is needed,