[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/3] iotests: Add "wait" functionality to _clean
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 2/3] iotests: Add "wait" functionality to _cleanup_qemu |
Date: |
Tue, 03 Feb 2015 09:38:59 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
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 <address@hidden>
> ---
> 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 "address@hidden"
> 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 <address@hidden>