From nobody Wed Apr 16 08:03:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149945088697395.58049140904177; Fri, 7 Jul 2017 11:08:06 -0700 (PDT) Received: from localhost ([::1]:58040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTXfe-0006uc-Co for importer@patchew.org; Fri, 07 Jul 2017 14:08:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTWmk-0006tZ-Lt for qemu-devel@nongnu.org; Fri, 07 Jul 2017 13:11:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTWmj-0001Hj-4C for qemu-devel@nongnu.org; Fri, 07 Jul 2017 13:11:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59672) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dTWmf-0001En-DM; Fri, 07 Jul 2017 13:11:13 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 75A06C056828; Fri, 7 Jul 2017 17:11:12 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-34.ams2.redhat.com [10.36.117.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8427F61F23; Fri, 7 Jul 2017 17:11:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 75A06C056828 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 75A06C056828 From: Kevin Wolf To: qemu-block@nongnu.org Date: Fri, 7 Jul 2017 19:08:49 +0200 Message-Id: <1499447335-6125-95-git-send-email-kwolf@redhat.com> In-Reply-To: <1499447335-6125-1-git-send-email-kwolf@redhat.com> References: <1499447335-6125-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 07 Jul 2017 17:11:12 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 094/100] iotests: fix remainining tests to work with LUKS X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Berrange" The tests 033, 140, 145 and 157 were all broken when run with LUKS, since they did not correctly use the required image opts args syntax to specify the decryption secret. Further, the 120 test simply does not make sense to run with luks, as the scenario exercised is not relevant. The test 181 was broken when run with LUKS because it didn't take account of fact that $TEST_IMG was already in image opts syntax. The launch_qemu helper also didn't register the secret object providing the LUKS password. Reviewed-by: Max Reitz Reviewed-by: Eric Blake Signed-off-by: Daniel P. Berrange Message-id: 20170626123510.20134-3-berrange@redhat.com Signed-off-by: Max Reitz --- tests/qemu-iotests/033 | 12 ++++++++++-- tests/qemu-iotests/120 | 1 + tests/qemu-iotests/140 | 9 ++++++++- tests/qemu-iotests/145 | 19 +++++++++++++++++-- tests/qemu-iotests/157 | 17 ++++++++++++++--- tests/qemu-iotests/157.out | 16 ++++++++-------- tests/qemu-iotests/174 | 2 +- tests/qemu-iotests/181 | 21 ++++++++++++++++----- tests/qemu-iotests/common.qemu | 9 +++++++-- 9 files changed, 82 insertions(+), 24 deletions(-) diff --git a/tests/qemu-iotests/033 b/tests/qemu-iotests/033 index 16edcf2..2cdfd13 100755 --- a/tests/qemu-iotests/033 +++ b/tests/qemu-iotests/033 @@ -50,10 +50,18 @@ do_test() local align=3D$1 local iocmd=3D$2 local img=3D$3 + if [ "$IMGOPTSSYNTAX" =3D "true" ] + then + IO_OPEN_ARG=3D"$img" + IO_EXTRA_ARGS=3D"--image-opts" + else + IO_OPEN_ARG=3D"-o driver=3D$IMGFMT,file.align=3D$align blkdebug::$img" + IO_EXTRA_ARGS=3D"" + fi { - echo "open -o driver=3D$IMGFMT,file.align=3D$align blkdebug::$img" + echo "open $IO_OPEN_ARG" echo $iocmd - } | $QEMU_IO + } | $QEMU_IO $IO_EXTRA_ARGS } =20 for write_zero_cmd in "write -z" "aio_write -z"; do diff --git a/tests/qemu-iotests/120 b/tests/qemu-iotests/120 index 4f88a67..f40b97d 100755 --- a/tests/qemu-iotests/120 +++ b/tests/qemu-iotests/120 @@ -41,6 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt generic _supported_proto file _supported_os Linux +_unsupported_fmt luks =20 _make_test_img 64M =20 diff --git a/tests/qemu-iotests/140 b/tests/qemu-iotests/140 index 8c80a5a..f89d0d6 100755 --- a/tests/qemu-iotests/140 +++ b/tests/qemu-iotests/140 @@ -52,8 +52,15 @@ _make_test_img 64k =20 $QEMU_IO -c 'write -P 42 0 64k' "$TEST_IMG" | _filter_qemu_io =20 +if test "$IMGOPTSSYNTAX" =3D "true" +then + SYSEMU_DRIVE_ARG=3Dif=3Dnone,media=3Dcdrom,id=3Ddrv,"$TEST_IMG" +else + SYSEMU_DRIVE_ARG=3Dif=3Dnone,media=3Dcdrom,id=3Ddrv,file=3D"$TEST_IMG"= ,driver=3D$IMGFMT +fi + keep_stderr=3Dy \ -_launch_qemu -drive if=3Dnone,media=3Dcdrom,id=3Ddrv,file=3D"$TEST_IMG",fo= rmat=3D$IMGFMT \ +_launch_qemu -drive $SYSEMU_DRIVE_ARG \ 2> >(_filter_nbd) =20 _send_qemu_cmd $QEMU_HANDLE \ diff --git a/tests/qemu-iotests/145 b/tests/qemu-iotests/145 index e6c6bc4..c371b3c 100755 --- a/tests/qemu-iotests/145 +++ b/tests/qemu-iotests/145 @@ -43,8 +43,23 @@ _supported_proto generic _supported_os Linux =20 _make_test_img 1M -echo quit | $QEMU -nographic -hda "$TEST_IMG" -incoming 'exec:true' -snaps= hot -serial none -monitor stdio | - _filter_qemu | _filter_hmp + +if test "$IMGOPTSSYNTAX" =3D "true" +then + SYSEMU_DRIVE_ARG=3Dif=3Dnone,$TEST_IMG + SYSEMU_EXTRA_ARGS=3D"" + if [ -n "$IMGKEYSECRET" ]; then + SECRET_ARG=3D"secret,id=3Dkeysec0,data=3D$IMGKEYSECRET" + SYSEMU_EXTRA_ARGS=3D"-object $SECRET_ARG" + fi +else + SYSEMU_DRIVE_ARG=3Dif=3Dnone,file=3D"$TEST_IMG",driver=3D$IMGFMT + SYSEMU_EXTRA_ARGS=3D"" +fi + +echo quit | $QEMU -nographic $SYSEMU_EXTRA_ARGS -drive $SYSEMU_DRIVE_ARG \ + -incoming 'exec:true' -snapshot -serial none -monitor st= dio \ + | _filter_qemu | _filter_hmp =20 # success, all done echo "*** done" diff --git a/tests/qemu-iotests/157 b/tests/qemu-iotests/157 index 8d939cb..2bf02be 100755 --- a/tests/qemu-iotests/157 +++ b/tests/qemu-iotests/157 @@ -43,7 +43,6 @@ _supported_os Linux =20 function do_run_qemu() { - echo Testing: "$@" ( if ! test -t 0; then while read cmd; do @@ -63,7 +62,18 @@ function run_qemu() =20 =20 size=3D128M -drive=3D"if=3Dnone,file=3D$TEST_IMG,driver=3D$IMGFMT" +if test "$IMGOPTSSYNTAX" =3D "true" +then + SYSEMU_DRIVE_ARG=3Dif=3Dnone,$TEST_IMG + SYSEMU_EXTRA_ARGS=3D"" + if [ -n "$IMGKEYSECRET" ]; then + SECRET_ARG=3D"secret,id=3Dkeysec0,data=3D$IMGKEYSECRET" + SYSEMU_EXTRA_ARGS=3D"-object $SECRET_ARG" + fi +else + SYSEMU_DRIVE_ARG=3Dif=3Dnone,file=3D"$TEST_IMG",driver=3D$IMGFMT + SYSEMU_EXTRA_ARGS=3D"" +fi =20 _make_test_img $size =20 @@ -76,8 +86,9 @@ echo =20 for cache in "writeback" "writethrough"; do for wce in "" ",write-cache=3Dauto" ",write-cache=3Don" ",write-cache= =3Doff"; do + echo "Testing: cache=3D'$cache' wce=3D'$wce'" echo "info block" \ - | run_qemu -drive "$drive,cache=3D$cache" \ + | run_qemu $SYSEMU_EXTRA_ARGS -drive "$SYSEMU_DRIVE_ARG,cache= =3D$cache" \ -device "virtio-blk,drive=3Dnone0$wce" \ | grep -e "Testing" -e "Cache mode" done diff --git a/tests/qemu-iotests/157.out b/tests/qemu-iotests/157.out index 77a9c03..fdc807f 100644 --- a/tests/qemu-iotests/157.out +++ b/tests/qemu-iotests/157.out @@ -3,20 +3,20 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D13421= 7728 =20 =3D=3D=3D Setting WCE with qdev and with manually created BB =3D=3D=3D =20 -Testing: -drive if=3Dnone,file=3DTEST_DIR/t.IMGFMT,driver=3DIMGFMT,cache= =3Dwriteback -device virtio-blk,drive=3Dnone0 +Testing: cache=3D'writeback' wce=3D'' Cache mode: writeback -Testing: -drive if=3Dnone,file=3DTEST_DIR/t.IMGFMT,driver=3DIMGFMT,cache= =3Dwriteback -device virtio-blk,drive=3Dnone0,write-cache=3Dauto +Testing: cache=3D'writeback' wce=3D',write-cache=3Dauto' Cache mode: writeback -Testing: -drive if=3Dnone,file=3DTEST_DIR/t.IMGFMT,driver=3DIMGFMT,cache= =3Dwriteback -device virtio-blk,drive=3Dnone0,write-cache=3Don +Testing: cache=3D'writeback' wce=3D',write-cache=3Don' Cache mode: writeback -Testing: -drive if=3Dnone,file=3DTEST_DIR/t.IMGFMT,driver=3DIMGFMT,cache= =3Dwriteback -device virtio-blk,drive=3Dnone0,write-cache=3Doff +Testing: cache=3D'writeback' wce=3D',write-cache=3Doff' Cache mode: writethrough -Testing: -drive if=3Dnone,file=3DTEST_DIR/t.IMGFMT,driver=3DIMGFMT,cache= =3Dwritethrough -device virtio-blk,drive=3Dnone0 +Testing: cache=3D'writethrough' wce=3D'' Cache mode: writethrough -Testing: -drive if=3Dnone,file=3DTEST_DIR/t.IMGFMT,driver=3DIMGFMT,cache= =3Dwritethrough -device virtio-blk,drive=3Dnone0,write-cache=3Dauto +Testing: cache=3D'writethrough' wce=3D',write-cache=3Dauto' Cache mode: writethrough -Testing: -drive if=3Dnone,file=3DTEST_DIR/t.IMGFMT,driver=3DIMGFMT,cache= =3Dwritethrough -device virtio-blk,drive=3Dnone0,write-cache=3Don +Testing: cache=3D'writethrough' wce=3D',write-cache=3Don' Cache mode: writeback -Testing: -drive if=3Dnone,file=3DTEST_DIR/t.IMGFMT,driver=3DIMGFMT,cache= =3Dwritethrough -device virtio-blk,drive=3Dnone0,write-cache=3Doff +Testing: cache=3D'writethrough' wce=3D',write-cache=3Doff' Cache mode: writethrough *** done diff --git a/tests/qemu-iotests/174 b/tests/qemu-iotests/174 index c1c20a1a..552879d 100755 --- a/tests/qemu-iotests/174 +++ b/tests/qemu-iotests/174 @@ -41,7 +41,7 @@ _unsupported_fmt raw =20 =20 size=3D256K -IMGFMT=3Draw IMGOPTS=3D _make_test_img $size | _filter_imgfmt +IMGFMT=3Draw IMGKEYSECRET=3D IMGOPTS=3D _make_test_img $size | _filter_img= fmt =20 echo echo "=3D=3D reading wrong format should fail =3D=3D" diff --git a/tests/qemu-iotests/181 b/tests/qemu-iotests/181 index f73ad5a..0333dda 100755 --- a/tests/qemu-iotests/181 +++ b/tests/qemu-iotests/181 @@ -57,13 +57,24 @@ echo =20 qemu_comm_method=3D"monitor" =20 -_launch_qemu \ - -drive file=3D"${TEST_IMG}",cache=3D${CACHEMODE},driver=3D$IMGFMT,id= =3Ddisk +if [ "$IMGOPTSSYNTAX" =3D "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=3D${CACHEMODE},id=3Ddisk +else + _launch_qemu \ + -drive file=3D"${TEST_IMG}",cache=3D${CACHEMODE},driver=3D$IMGFMT,= id=3Ddisk +fi src=3D$QEMU_HANDLE =20 -_launch_qemu \ - -drive file=3D"${TEST_IMG}",cache=3D${CACHEMODE},driver=3D$IMGFMT,id= =3Ddisk \ - -incoming "unix:${MIG_SOCKET}" +if [ "$IMGOPTSSYNTAX" =3D "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=3D${CACHEMODE},id=3Ddisk \ + -incoming "unix:${MIG_SOCKET}" +else + _launch_qemu \ + -drive file=3D"${TEST_IMG}",cache=3D${CACHEMODE},driver=3D$IMGFMT,= id=3Ddisk \ + -incoming "unix:${MIG_SOCKET}" +fi dest=3D$QEMU_HANDLE =20 echo diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu index 76ef298..7645f1d 100644 --- a/tests/qemu-iotests/common.qemu +++ b/tests/qemu-iotests/common.qemu @@ -153,14 +153,19 @@ function _launch_qemu() mkfifo "${fifo_out}" mkfifo "${fifo_in}" =20 + object_options=3D + if [ -n "$IMGKEYSECRET" ]; then + object_options=3D"--object secret,id=3Dkeysec0,data=3D$IMGKEYSECRE= T" + fi + if [ -z "$keep_stderr" ]; then QEMU_NEED_PID=3D'y'\ - ${QEMU} -nographic -serial none ${comm} "${@}" >"${fifo_out}" \ + ${QEMU} ${object_options} -nographic -serial none ${comm} "${@}" >= "${fifo_out}" \ 2>&1 \ <"${fifo_in}" & elif [ "$keep_stderr" =3D "y" ]; then QEMU_NEED_PID=3D'y'\ - ${QEMU} -nographic -serial none ${comm} "${@}" >"${fifo_out}" \ + ${QEMU} ${object_options} -nographic -serial none ${comm} "${@}" >= "${fifo_out}" \ <"${fifo_in}" & else exit 1 --=20 1.8.3.1