From: Paolo Bonzini <pbonzini@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/3] iotests: Add "wait" functionality to _cleanup_qemu
Date: Tue, 03 Feb 2015 09:38:59 +0100 [thread overview]
Message-ID: <54D08923.4060905@redhat.com> (raw)
In-Reply-To: <1422913238-7280-3-git-send-email-mreitz@redhat.com>
On 02/02/2015 22:40, Max Reitz wrote:
> The qemu process does not always need to be killed, just waiting for it
> can be fine, too. This introduces a way to do so.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> tests/qemu-iotests/common.qemu | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu
> index 8e618b5..4e1996c 100644
> --- a/tests/qemu-iotests/common.qemu
> +++ b/tests/qemu-iotests/common.qemu
> @@ -187,13 +187,23 @@ function _launch_qemu()
>
>
> # Silenty kills the QEMU process
> +#
> +# If $wait is set to anything other than the empty string, the process will not
> +# be killed but only waited for, and any output will be forwarded to stdout. If
> +# $wait is empty, the process will be killed and all output will be suppressed.
> function _cleanup_qemu()
> {
> # QEMU_PID[], QEMU_IN[], QEMU_OUT[] all use same indices
> for i in "${!QEMU_OUT[@]}"
> do
> - kill -KILL ${QEMU_PID[$i]} 2>/dev/null
> + if [ -z "${wait}" ]; then
> + kill -KILL ${QEMU_PID[$i]} 2>/dev/null
> + fi
> wait ${QEMU_PID[$i]} 2>/dev/null # silent kill
> + if [ -n "${wait}" ]; then
> + cat <&${QEMU_OUT[$i]} | _filter_testdir | _filter_qemu \
> + | _filter_qemu_io | _filter_qmp
> + fi
> rm -f "${QEMU_FIFO_IN}_${i}" "${QEMU_FIFO_OUT}_${i}"
> eval "exec ${QEMU_IN[$i]}<&-" # close file descriptors
> eval "exec ${QEMU_OUT[$i]}<&-"
>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
next prev parent reply other threads:[~2015-02-03 8:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-02 21:40 [Qemu-devel] [PATCH 0/3] nbd: Drop BDS backpointer Max Reitz
2015-02-02 21:40 ` [Qemu-devel] [PATCH 1/3] " Max Reitz
2015-02-03 8:37 ` Paolo Bonzini
2015-02-03 13:54 ` Max Reitz
2015-02-02 21:40 ` [Qemu-devel] [PATCH 2/3] iotests: Add "wait" functionality to _cleanup_qemu Max Reitz
2015-02-03 8:38 ` Paolo Bonzini [this message]
2015-02-02 21:40 ` [Qemu-devel] [PATCH 3/3] iotests: Add test for drive-mirror with NBD target Max Reitz
2015-02-03 8:38 ` Paolo Bonzini
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=54D08923.4060905@redhat.com \
--to=pbonzini@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@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).