From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: "Thomas Huth" <thuth@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
QEMU <qemu-devel@nongnu.org>, "Tiwei Bie" <tiwei.bie@intel.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: [Qemu-devel] [PATCH] libqtest: fail if child coredumps
Date: Thu, 24 May 2018 18:18:51 +0300 [thread overview]
Message-ID: <20180524181754-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAJ+F1CKg2yY24erk72rnt4F28t1-zvzviVKJvA7hW=kt=yBa_g@mail.gmail.com>
On Thu, May 24, 2018 at 05:04:56PM +0200, Marc-André Lureau wrote:
> Hi
>
> On Thu, May 24, 2018 at 5:00 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> > On Thu, May 24, 2018 at 04:45:31PM +0200, Thomas Huth wrote:
> >> 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 <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));
> >> > + }
> >> > }
> >> > }
> >>
> >> 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
> >
> > Fine but can we agree to do this as a patch on top? And do you have
> > the time to implement this?
> >
> > I'm seeing patches that cause crash on cleanup, it's not a theoretical
> > problem for me, so I'd like this one to go in first.
>
> What is the difference between sending "quit" and SIGTERM (qemu has
> code to handle it in termsig_handler()). Is this documented somewhere?
SIGTERM might wake QEMU if it's blocked somewhere in kernel.
Sending quit also tests QMP isn't blocked.
>
> --
> Marc-André Lureau
next prev parent reply other threads:[~2018-05-24 15:18 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-24 14:30 [Qemu-devel] [PATCH] libqtest: fail if child coredumps Michael S. Tsirkin
2018-05-24 14:45 ` Thomas Huth
2018-05-24 15:00 ` Michael S. Tsirkin
2018-05-24 15:04 ` Marc-André Lureau
2018-05-24 15:18 ` Michael S. Tsirkin [this message]
2018-05-24 15:46 ` Thomas Huth
2018-05-24 15:51 ` Michael S. Tsirkin
2018-05-24 16:01 ` Thomas Huth
2018-05-24 15:17 ` [Qemu-devel] [PATCH 2/1] libqtest: add more exit status checks Michael S. Tsirkin
2018-05-24 15:24 ` Eric Blake
2018-05-24 15:38 ` [Qemu-devel] [PATCH v2 " Michael S. Tsirkin
2018-05-24 15:52 ` Eric Blake
2018-05-24 16:00 ` Eric Blake
2018-05-24 16:01 ` Michael S. Tsirkin
2018-05-24 18:16 ` Eric Blake
2018-05-24 18:20 ` Michael S. Tsirkin
2018-05-25 5:40 ` Markus Armbruster
2018-05-24 16:00 ` Michael S. Tsirkin
2018-05-24 15:54 ` Thomas Huth
2018-05-24 16:01 ` Michael S. Tsirkin
2018-05-24 16:11 ` [Qemu-devel] [PATCH v3 " Michael S. Tsirkin
2018-05-24 17:26 ` Thomas Huth
2018-05-24 17:33 ` Michael S. Tsirkin
2018-05-24 17:58 ` Thomas Huth
2018-05-24 18:15 ` Michael S. Tsirkin
2018-05-24 15:02 ` [Qemu-devel] [PATCH] libqtest: fail if child coredumps Peter Maydell
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=20180524181754-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=armbru@redhat.com \
--cc=f4bug@amsat.org \
--cc=marcandre.lureau@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
--cc=tiwei.bie@intel.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).