qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/4] block: qemu-iotests - add common.qemu, for


From: Fam Zheng
Subject: Re: [Qemu-devel] [PATCH 1/4] block: qemu-iotests - add common.qemu, for bash-controlled qemu tests
Date: Thu, 10 Apr 2014 10:03:00 +0800
User-agent: Mutt/1.5.23 (2014-03-12)

On Mon, 03/17 21:24, Jeff Cody wrote:
> +# Launch a QEMU process.
> +#
> +# Input parameters:
> +# $qemu_comm_method: set this variable to 'monitor' (case insensitive)
> +#                    to use the QEMU HMP monitor for communication.
> +#                    Otherwise, the default of QMP is used.
> +# Returns:
> +# $QEMU_HANDLE: set to a handle value to communicate with this QEMU instance.
> +#
> +function _launch_qemu()
> +{
> +    local comm=
> +    local fifo_out=
> +    local fifo_in=
> +
> +    if (shopt -s nocasematch; [[ "${qemu_comm_method}" == "monitor" ]])
> +    then
> +        comm="-monitor stdio -qmp none"
> +    else
> +        local qemu_comm_method="qmp"
> +        comm="-monitor none -qmp stdio"
> +    fi
> +
> +    fifo_out=${QEMU_FIFO_OUT}_${_QEMU_HANDLE}
> +    fifo_in=${QEMU_FIFO_IN}_${_QEMU_HANDLE}
> +    mkfifo "${fifo_out}"
> +    mkfifo "${fifo_in}"
> +
> +    "${QEMU}" -nographic -serial none ${comm} "address@hidden" 2>&1 \
> +                                                     >"${fifo_out}" \
> +                                                     <"${fifo_in}" &

Shall we use '-machine accel=qtest' as we do in iotests.py (to run no guest
code)?  Because below patch has a big difference of 067's stability and run
time in my case:

diff --git a/tests/qemu-iotests/067 b/tests/qemu-iotests/067
index d025192..a379a3b 100755
--- a/tests/qemu-iotests/067
+++ b/tests/qemu-iotests/067
@@ -39,7 +39,7 @@ _supported_os Linux
 function do_run_qemu()
 {
     echo Testing: "$@"
-    $QEMU -nographic -qmp stdio -serial none "$@"
+    $QEMU -nographic -machine accel=qtest -qmp stdio -serial none "$@"
     echo
 }


Fam

> +    QEMU_PID[${_QEMU_HANDLE}]=$!
> +
> +    if [ "${BASH_VERSINFO[0]}" -ge "4" ] && [ "${BASH_VERSINFO[1]}" -ge "1" ]
> +    then
> +        # bash >= 4.1 required for automatic fd
> +        exec {_out_fd}<"${fifo_out}"
> +        exec {_in_fd}>"${fifo_in}"
> +    else
> +        let _out_fd++
> +        let _in_fd++
> +        eval "exec ${_out_fd}<'${fifo_out}'"
> +        eval "exec ${_in_fd}>'${fifo_in}'"
> +    fi
> +
> +    QEMU_OUT[${_QEMU_HANDLE}]=${_out_fd}
> +    QEMU_IN[${_QEMU_HANDLE}]=${_in_fd}
> +
> +    if [ "${qemu_comm_method}" == "qmp" ]
> +    then
> +        # Don't print response, since it has version information in it
> +        silent=yes _timed_wait_for ${_QEMU_HANDLE} "capabilities"
> +    fi
> +    QEMU_HANDLE=${_QEMU_HANDLE}
> +    let _QEMU_HANDLE++
> +}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]