Add more checks on how did QEMU exit. Legal ways to exit right now: - exit(0) or return from main - kill(SIGTERM) - sent by testing infrastructure
Signed-off-by: Michael S. Tsirkin <[email protected]> --- Changes from v1: - drop SIGTERM as suggested by Eric tests/libqtest.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/libqtest.c b/tests/libqtest.c index f869854..0576874 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -110,7 +110,12 @@ static void kill_qemu(QTestState *s) pid = waitpid(s->qemu_pid, &wstatus, 0); if (pid == s->qemu_pid && WIFSIGNALED(wstatus)) { + /* Core dump is never OK */ assert(!WCOREDUMP(wstatus)); + /* Must exit normally */ + assert(WIFEXITED(wstatus)); + /* If exited normally - check exit status */ + assert(!WIFEXITED(wstatus) || !WEXITSTATUS(wstatus)); } } } -- MST
