Skip to content

Commit fa0d421

Browse files
committed
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 <[email protected]> Acked-by: Thomas Huth <[email protected]>
1 parent 28012e1 commit fa0d421

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/libqtest.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,15 @@ static int socket_accept(int sock)
103103
static void kill_qemu(QTestState *s)
104104
{
105105
if (s->qemu_pid != -1) {
106+
int wstatus = 0;
107+
pid_t pid;
108+
106109
kill(s->qemu_pid, SIGTERM);
107-
waitpid(s->qemu_pid, NULL, 0);
110+
pid = waitpid(s->qemu_pid, &wstatus, 0);
111+
112+
if (pid == s->qemu_pid && WIFSIGNALED(wstatus)) {
113+
assert(!WCOREDUMP(wstatus));
114+
}
108115
}
109116
}
110117

0 commit comments

Comments
 (0)