diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2018-05-24 17:24:35 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2018-05-25 17:08:39 +0300 |
commit | fa0d421f39b353ed2de901bb798f81ce9824c2f3 (patch) | |
tree | 525ac3168fa9ae8b9c666293f9318b550f1bc181 /tests | |
parent | 28012e190e6897cfc2a98364240909d08e90ffc0 (diff) |
libqtest: fail if child coredumps
Right now tests report OK status if QEMU crashes during cleanup.
Let's catch that case and fail the test.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/libqtest.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/libqtest.c b/tests/libqtest.c index 43fb97e035..f869854849 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -103,8 +103,15 @@ static int socket_accept(int sock) static void kill_qemu(QTestState *s) { if (s->qemu_pid != -1) { + int wstatus = 0; + pid_t pid; + kill(s->qemu_pid, SIGTERM); - waitpid(s->qemu_pid, NULL, 0); + pid = waitpid(s->qemu_pid, &wstatus, 0); + + if (pid == s->qemu_pid && WIFSIGNALED(wstatus)) { + assert(!WCOREDUMP(wstatus)); + } } } |