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: Re: [Qemu-devel] [PATCH v4 3/3] libqtest: add more exit status checks
Date: Fri, 25 May 2018 17:07:41 +0300 [thread overview]
Message-ID: <20180525170512-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1527186303-192100-4-git-send-email-mst@redhat.com>
On Thu, May 24, 2018 at 09:25:28PM +0300, Michael S. Tsirkin wrote:
> 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 <mst@redhat.com>
> ---
This turned out to be messy since
- abort itself might trigger a signal
- waitpid might in theory get interrupted
I'll drop this patch for now, and merge just patches 1 and 2
in my tree.
> tests/libqtest.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/tests/libqtest.c b/tests/libqtest.c
> index f869854..36ca859 100644
> --- a/tests/libqtest.c
> +++ b/tests/libqtest.c
> @@ -109,9 +109,19 @@ static void kill_qemu(QTestState *s)
> kill(s->qemu_pid, SIGTERM);
> pid = waitpid(s->qemu_pid, &wstatus, 0);
>
> - if (pid == s->qemu_pid && WIFSIGNALED(wstatus)) {
> + /* waitpid returns child PID on success */
> + assert(pid == s->qemu_pid);
> +
> + /* If exited on signal - check the reason: core dump is never OK */
> + if (WIFSIGNALED(wstatus)) {
> assert(!WCOREDUMP(wstatus));
> }
> + /* If exited normally - check exit status */
> + if (WIFEXITED(wstatus)) {
> + assert(!WEXITSTATUS(wstatus));
> + }
> + /* Valid ways to exit: right now only return from main or exit */
> + assert(WIFEXITED(wstatus));
> }
> }
>
> --
> MST
>
prev parent reply other threads:[~2018-05-25 14:07 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 ` [Qemu-devel] [PATCH v4 2/3] libqtest: fail if child coredumps Michael S. Tsirkin
2018-05-25 6:10 ` 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 [this message]
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=20180525170512-mutt-send-email-mst@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.