[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/1] libqtest: add more exit status checks
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 2/1] libqtest: add more exit status checks |
Date: |
Thu, 24 May 2018 10:24:40 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 05/24/2018 10:17 AM, 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
Yes, but kill(SIGTERM) causes qemu proper to exit with status 0, because
we handle the signal rather than letting it have default behavior or
rethrowing it.
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.
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)));
Eww. This is true if someone does SIGKILL, but not if someone does SIGTERM.
+ /* Exited normally - check exit status. */
+ assert(!WIFEXITED(wstatus) || WEXITSTATUS(wstatus) == 0);
This is fine.
+ /* Killed - we only ever send SIGTERM. */
+ assert(!WIFSIGNALED(wstatus) || WTERMSIG(wstatus) == SIGTERM);
But this is bogus. Sending SIGTERM does NOT cause WIFSIGNALED(); you'd
be hard-pressed to get qemu to exit with WTERMSIG(wstatus) == SIGTERM.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[Qemu-devel] [PATCH 2/1] libqtest: add more exit status checks, Michael S. Tsirkin, 2018/05/24
- Re: [Qemu-devel] [PATCH 2/1] libqtest: add more exit status checks,
Eric Blake <=
[Qemu-devel] [PATCH v2 2/1] libqtest: add more exit status checks, Michael S. Tsirkin, 2018/05/24
- Re: [Qemu-devel] [PATCH v2 2/1] libqtest: add more exit status checks, Eric Blake, 2018/05/24
- Re: [Qemu-devel] [PATCH v2 2/1] libqtest: add more exit status checks, Michael S. Tsirkin, 2018/05/24
- Re: [Qemu-devel] [PATCH v2 2/1] libqtest: add more exit status checks, Eric Blake, 2018/05/24
- Re: [Qemu-devel] [PATCH v2 2/1] libqtest: add more exit status checks, Michael S. Tsirkin, 2018/05/24
- Re: [Qemu-devel] [PATCH v2 2/1] libqtest: add more exit status checks, Eric Blake, 2018/05/24
- Re: [Qemu-devel] [PATCH v2 2/1] libqtest: add more exit status checks, Michael S. Tsirkin, 2018/05/24
- Re: [Qemu-devel] [PATCH v2 2/1] libqtest: add more exit status checks, Markus Armbruster, 2018/05/25
Re: [Qemu-devel] [PATCH v2 2/1] libqtest: add more exit status checks, Thomas Huth, 2018/05/24
Re: [Qemu-devel] [PATCH v2 2/1] libqtest: add more exit status checks, Michael S. Tsirkin, 2018/05/24