[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] libqtest: fail if child coredumps
From: |
Thomas Huth |
Subject: |
Re: [Qemu-devel] [PATCH] libqtest: fail if child coredumps |
Date: |
Thu, 24 May 2018 16:45:31 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 24.05.2018 16:30, Michael S. Tsirkin wrote:
> 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 <address@hidden>
> ---
> 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));
> + }
> }
> }
That's basically a good idea ... but I've already seen yet another issue
in the past already: QEMU sometimes simply hangs in an endless loop
during clean up and never terminates. I think we should detect that
situation, too.
So instead of killing QEMU at the end of the testing, I think we should
rather try to terminate it with the QMP "quit" command. If QEMU does not
terminate with an exit code of 0, then the test should be flagged a
failed (and only if QEMU did not terminate at all, it should be killed
with SIGKILL).
Thomas
[Qemu-devel] [PATCH 2/1] libqtest: add more exit status checks, Michael S. Tsirkin, 2018/05/24
[Qemu-devel] [PATCH v2 2/1] libqtest: add more exit status checks, Michael S. Tsirkin, 2018/05/24