From: Andrew Jones <drjones@redhat.com>
To: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: kvm@vger.kernel.org, pbonzini@redhat.com, peter.maydell@linaro.org
Subject: Re: [kvm-unit-tests PATCH v2] runtime: better handling of QEMU aborts
Date: Thu, 17 Nov 2016 18:06:56 +0100 [thread overview]
Message-ID: <20161117170656.mokgfuixb7ncktww@hawk.localdomain> (raw)
In-Reply-To: <20161116204728.GC20282@potion>
On Wed, Nov 16, 2016 at 09:47:29PM +0100, Radim Krčmář wrote:
> 2016-11-15 18:26+0100, Andrew Jones:
> > Add two changes to run_qemu. The first saves/restores terminal settings.
> > This solves an annoying loss of terminal echo when QEMU aborts during
> > a test run. The second ensures we see a message about the abort, because
> > the "Aborted (core dumped)" message we should see gets eaten. We also
> > add a message to run()'s failure cases in its exit code processing to
> > handle signals in general.
> >
> > Note, the first change is necessary because QEMU modifies the terminal
> > settings when using '-serial stdio', but calling abort() invokes exit
> > without first calling qemu_chr_free(serial_hds[0]) to restore them.
> >
> > (Additionally we fixup the premature failure check to only capture the
> > last line, like it says it's doing.)
> >
> > Reported-by: Peter Maydell <peter.maydell@linaro.org>
> > Signed-off-by: Andrew Jones <drjones@redhat.com>
> >
> > ---
> > v2:
> > - rebase to latest master and add FAIL case to run()'s exit code
> > processing [Radim]
> > - add '>(tail -1) to premature failure check [Radim]
> > ---
> > diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
> > @@ -26,13 +26,16 @@
> > ##############################################################################
> > run_qemu ()
> > {
> > - local stdout errors ret sig
> > + local stdout errors ret sig tty
> >
> > # stdout to {stdout}, stderr to $errors and stderr
> > + tty=$(stty -g)
> > exec {stdout}>&1
> > errors=$("${@}" 2> >(tee /dev/stderr) > /dev/fd/$stdout)
> > ret=$?
> > + [ $ret -eq 134 ] && echo "QEMU Aborted" > /dev/fd/$stdout
>
> Standard output is /dev/fd/$stdout here (unlike in parentheses, where it
> was $errors). I can remove the redirection when applying, but
> redirecting to stderr would also make sense -- what do you prefer?
stderr works for me. Thanks for the fixups
drew
>
> > exec {stdout}>&-
> > + stty "$tty"
> >
> > if [ "$errors" ]; then
> > sig=$(grep 'terminating on signal' <<<"$errors")
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-11-17 17:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-15 17:26 [kvm-unit-tests PATCH v2] runtime: better handling of QEMU aborts Andrew Jones
2016-11-16 20:47 ` Radim Krčmář
2016-11-17 17:06 ` Andrew Jones [this message]
2016-11-22 13:58 ` Radim Krčmář
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=20161117170656.mokgfuixb7ncktww@hawk.localdomain \
--to=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=rkrcmar@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).