qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Jeff Cody <jcody@redhat.com>
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com,
	benoit@irqsave.net
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	[thread overview]
Message-ID: <20140410020300.GB2855@T430.nay.redhat.com> (raw)
In-Reply-To: <5e57ec8dce227b3095dd476e893137f2b14c0d81.1395105370.git.jcody@redhat.com>

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} "${@}" 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++
> +}

  parent reply	other threads:[~2014-04-10  2:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-18  1:24 [Qemu-devel] [PATCH 0/4] Add common QEMU control functionality to qemu-iotests Jeff Cody
2014-03-18  1:24 ` [Qemu-devel] [PATCH 1/4] block: qemu-iotests - add common.qemu, for bash-controlled qemu tests Jeff Cody
2014-03-19 13:39   ` Benoît Canet
2014-03-19 14:19     ` Jeff Cody
2014-03-19 14:28       ` Eric Blake
2014-03-19 14:32         ` Eric Blake
2014-03-19 14:45         ` Jeff Cody
2014-03-19 14:53           ` Eric Blake
2014-04-10  2:03   ` Fam Zheng [this message]
2014-03-18  1:24 ` [Qemu-devel] [PATCH 2/4] block: qemu-iotests - update 085 to use common.qemu Jeff Cody
2014-03-19 13:44   ` Benoît Canet
2014-03-18  1:24 ` [Qemu-devel] [PATCH 3/4] block: qemu-iotests - fix image cleanup when using spaced pathnames Jeff Cody
2014-03-19 13:46   ` Benoît Canet
2014-03-18  1:24 ` [Qemu-devel] [PATCH 4/4] block: qemu-iotests: make test 019 and 086 work with " Jeff Cody
2014-03-19 13:47   ` Benoît Canet

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=20140410020300.GB2855@T430.nay.redhat.com \
    --to=famz@redhat.com \
    --cc=benoit@irqsave.net \
    --cc=jcody@redhat.com \
    --cc=kwolf@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).