From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47590) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQGnd-0004jF-Pz for qemu-devel@nongnu.org; Wed, 19 Mar 2014 09:44:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQGnX-00071g-7i for qemu-devel@nongnu.org; Wed, 19 Mar 2014 09:44:53 -0400 Received: from lputeaux-656-01-25-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:56320 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQGnW-00071a-Un for qemu-devel@nongnu.org; Wed, 19 Mar 2014 09:44:47 -0400 Date: Wed, 19 Mar 2014 14:44:46 +0100 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140319134445.GB3019@irqsave.net> References: <23068cef0f656143a0e716675983139e3f40e571.1395105370.git.jcody@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <23068cef0f656143a0e716675983139e3f40e571.1395105370.git.jcody@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/4] block: qemu-iotests - update 085 to use common.qemu 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 The Monday 17 Mar 2014 =E0 21:24:38 (-0400), Jeff Cody wrote : > The new functionality of common.qemu implements the QEMU control > and communication functionality that was originally in test 085. >=20 > This removes that now-duplicate functionality, and uses the > common.qemu functions. >=20 > Signed-off-by: Jeff Cody > --- > tests/qemu-iotests/085 | 73 +++++++++---------------------------------= -------- > 1 file changed, 12 insertions(+), 61 deletions(-) >=20 > diff --git a/tests/qemu-iotests/085 b/tests/qemu-iotests/085 > index 33c8dc4..56cd6f8 100755 > --- a/tests/qemu-iotests/085 > +++ b/tests/qemu-iotests/085 > @@ -30,10 +30,6 @@ echo "QA output created by $seq" > =20 > here=3D`pwd` > status=3D1 # failure is the default! > -qemu_pid=3D > - > -QMP_IN=3D"${TEST_DIR}/qmp-in-$$" > -QMP_OUT=3D"${TEST_DIR}/qmp-out-$$" > =20 > snapshot_virt0=3D"snapshot-v0.qcow2" > snapshot_virt1=3D"snapshot-v1.qcow2" > @@ -42,10 +38,7 @@ MAX_SNAPSHOTS=3D10 > =20 > _cleanup() > { > - kill -KILL ${qemu_pid} > - wait ${qemu_pid} 2>/dev/null # silent kill > - > - rm -f "${QMP_IN}" "${QMP_OUT}" > + _cleanup_qemu > for i in $(seq 1 ${MAX_SNAPSHOTS}) > do > rm -f "${TEST_DIR}/${i}-${snapshot_virt0}" > @@ -59,43 +52,12 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 > # get standard environment, filters and checks > . ./common.rc > . ./common.filter > +. ./common.qemu > =20 > _supported_fmt qcow2 > _supported_proto file > _supported_os Linux > =20 > -# Wait for expected QMP response from QEMU. Will time out > -# after 10 seconds, which counts as failure. > -# > -# $1 is the string to expect > -# > -# If $silent is set to anything but an empty string, then > -# response is not echoed out. > -function timed_wait_for() > -{ > - while read -t 10 resp <&5 > - do > - if [ "${silent}" =3D=3D "" ]; then > - echo "${resp}" | _filter_testdir | _filter_qemu > - fi > - grep -q "${1}" < <(echo ${resp}) > - if [ $? -eq 0 ]; then > - return > - fi > - done > - echo "Timeout waiting for ${1}" > - exit 1 # Timeout means the test failed > -} > - > -# Sends QMP command to QEMU, and waits for the expected response > -# > -# ${1}: String of the QMP command to send > -# ${2}: String that the QEMU response should contain > -function send_qmp_cmd() > -{ > - echo "${1}" >&6 > - timed_wait_for "${2}" > -} > =20 > # ${1}: unique identifier for the snapshot filename > function create_single_snapshot() > @@ -104,7 +66,7 @@ function create_single_snapshot() > 'arguments': { 'device': 'virtio0', > 'snapshot-file':'"${TEST_DIR}/${1= }-${snapshot_virt0}"', > 'format': 'qcow2' } }" > - send_qmp_cmd "${cmd}" "return" > + _send_qemu_cmd $h "${cmd}" "return" > } > =20 > # ${1}: unique identifier for the snapshot filename > @@ -120,14 +82,11 @@ function create_group_snapshot() > 'snapshot-file': '"${TEST_DIR}/${1}-${snapshot_= virt1}"' } } ] > } }" > =20 > - send_qmp_cmd "${cmd}" "return" > + _send_qemu_cmd $h "${cmd}" "return" > } > =20 > size=3D128M > =20 > -mkfifo "${QMP_IN}" > -mkfifo "${QMP_OUT}" > - > _make_test_img $size > mv "${TEST_IMG}" "${TEST_IMG}.orig" > _make_test_img $size > @@ -136,23 +95,15 @@ echo > echo =3D=3D=3D Running QEMU =3D=3D=3D > echo > =20 > -"${QEMU}" -nographic -monitor none -serial none -qmp stdio\ > - -drive file=3D"${TEST_IMG}.orig",if=3Dvirtio\ > - -drive file=3D"${TEST_IMG}",if=3Dvirtio 2>&1 >"${QMP_OUT}" <= "${QMP_IN}"& > -qemu_pid=3D$! > - > -# redirect fifos to file descriptors, to keep from blocking > -exec 5<"${QMP_OUT}" > -exec 6>"${QMP_IN}" > - > -# Don't print response, since it has version information in it > -silent=3Dyes timed_wait_for "capabilities" > +qemu_comm_method=3D"qmp" > +_launch_qemu -drive file=3D"${TEST_IMG}.orig",if=3Dvirtio -drive file=3D= "${TEST_IMG}",if=3Dvirtio > +h=3D$QEMU_HANDLE > =20 > echo > echo =3D=3D=3D Sending capabilities =3D=3D=3D > echo > =20 > -send_qmp_cmd "{ 'execute': 'qmp_capabilities' }" "return" > +_send_qemu_cmd $h "{ 'execute': 'qmp_capabilities' }" "return" > =20 > echo > echo =3D=3D=3D Create a single snapshot on virtio0 =3D=3D=3D > @@ -165,16 +116,16 @@ echo > echo =3D=3D=3D Invalid command - missing device and nodename =3D=3D=3D > echo > =20 > -send_qmp_cmd "{ 'execute': 'blockdev-snapshot-sync', > - 'arguments': { 'snapshot-file':'"${TEST_DIR}"/1-= ${snapshot_virt0}', > +_send_qemu_cmd $h "{ 'execute': 'blockdev-snapshot-sync', > + 'arguments': { 'snapshot-file':'"${TEST_DIR}/= 1-${snapshot_virt0}"', > 'format': 'qcow2' } }" "error" > =20 > echo > echo =3D=3D=3D Invalid command - missing snapshot-file =3D=3D=3D > echo > =20 > -send_qmp_cmd "{ 'execute': 'blockdev-snapshot-sync', > - 'arguments': { 'device': 'virtio0', > +_send_qemu_cmd $h "{ 'execute': 'blockdev-snapshot-sync', > + 'arguments': { 'device': 'virtio0', > 'format': 'qcow2' } }" "error" > echo > echo > --=20 > 1.8.3.1 >=20 >=20 Reviewed-by: Benoit Canet