qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/1] libqtest: add more exit status checks


From: Michael S. Tsirkin
Subject: [Qemu-devel] [PATCH 2/1] libqtest: add more exit status checks
Date: Thu, 24 May 2018 18:17:31 +0300

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 <address@hidden>
Suggested-by: Thomas Huth <address@hidden>
---

TODO: refactor testing infrastructure to stop
QEMU through QMP as opposed to SIGTERM.


 tests/libqtest.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/libqtest.c b/tests/libqtest.c
index f869854..2470f57 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -110,7 +110,14 @@ 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));
+            /* Either exit normally or get killed */
+            assert((WIFEXITED(wstatus) || WIFSIGNALED(wstatus)));
+            /* Exited normally - check exit status. */
+            assert(!WIFEXITED(wstatus) || WEXITSTATUS(wstatus) == 0);
+            /* Killed - we only ever send SIGTERM. */
+            assert(!WIFSIGNALED(wstatus) || WTERMSIG(wstatus) == SIGTERM);
         }
     }
 }
-- 
MST



reply via email to

[Prev in Thread] Current Thread [Next in Thread]