qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Eric Blake" <eblake@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Markus Armbruster" <armbru@redhat.com>
Subject: [Qemu-devel] [PATCH v4 2/3] libqtest: fail if child coredumps
Date: Thu, 24 May 2018 21:25:27 +0300	[thread overview]
Message-ID: <1527186303-192100-3-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1527186303-192100-1-git-send-email-mst@redhat.com>

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>
---
 tests/libqtest.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/libqtest.c b/tests/libqtest.c
index 43fb97e..f869854 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));
+        }
     }
 }
 
-- 
MST

  parent reply	other threads:[~2018-05-24 18:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-24 18:25 [Qemu-devel] [PATCH v4 0/3] libqtest: verify QEMU exit status Michael S. Tsirkin
2018-05-24 18:25 ` [Qemu-devel] [PATCH v4 1/3] osdep: add wait.h compat macros Michael S. Tsirkin
2018-06-14 12:56   ` Markus Armbruster
2018-06-14 13:02     ` Peter Maydell
2018-05-24 18:25 ` Michael S. Tsirkin [this message]
2018-05-25  6:10   ` [Qemu-devel] [PATCH v4 2/3] libqtest: fail if child coredumps Thomas Huth
2018-05-25 11:22     ` Thomas Huth
2018-05-25 12:15     ` Michael S. Tsirkin
2018-05-25 14:05       ` Thomas Huth
2018-05-24 18:25 ` [Qemu-devel] [PATCH v4 3/3] libqtest: add more exit status checks Michael S. Tsirkin
2018-05-25 14:07   ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1527186303-192100-3-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).