From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51677) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WY4KV-0008Nj-QG for qemu-devel@nongnu.org; Wed, 09 Apr 2014 22:03:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WY4KP-0002rv-FU for qemu-devel@nongnu.org; Wed, 09 Apr 2014 22:03:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32185) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WY4KP-0002rq-7M for qemu-devel@nongnu.org; Wed, 09 Apr 2014 22:02:57 -0400 Date: Thu, 10 Apr 2014 10:03:00 +0800 From: Fam Zheng Message-ID: <20140410020300.GB2855@T430.nay.redhat.com> References: <5e57ec8dce227b3095dd476e893137f2b14c0d81.1395105370.git.jcody@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5e57ec8dce227b3095dd476e893137f2b14c0d81.1395105370.git.jcody@redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/4] block: qemu-iotests - add common.qemu, for bash-controlled qemu tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Cody Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, benoit@irqsave.net 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++ > +}