[Qemu-devel] [PATCH 1/2] iotests: rewrite 192 to use _launch_qemu to fix LUKS support

Daniel P. Berrange posted 2 patches 8 years, 2 months ago
[Qemu-devel] [PATCH 1/2] iotests: rewrite 192 to use _launch_qemu to fix LUKS support
Posted by Daniel P. Berrange 8 years, 2 months ago
The LUKS driver requires extra args to QEMU to setup passwords.
The _launch_qemu function takes care of this, so convert the
test to use this function and use correct -drive syntax

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 tests/qemu-iotests/192 | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/tests/qemu-iotests/192 b/tests/qemu-iotests/192
index b50a2c0c8e..595f0d786a 100755
--- a/tests/qemu-iotests/192
+++ b/tests/qemu-iotests/192
@@ -37,6 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 # get standard environment, filters and checks
 . ./common.rc
 . ./common.filter
+. ./common.qemu
 
 _supported_fmt generic
 _supported_proto file
@@ -49,13 +50,21 @@ fi
 size=64M
 _make_test_img $size
 
-{
-echo "nbd_server_start unix:$TEST_DIR/nbd"
-echo "nbd_server_add -w drive0"
-echo "q"
-} | $QEMU -nodefaults -display none -monitor stdio \
-    -drive format=$IMGFMT,file=$TEST_IMG,if=ide,id=drive0 \
-    -incoming defer 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp
+if test "$IMGOPTSSYNTAX" = "true"
+then
+    DRIVE_ARG=if=ide,id=drive0,$TEST_IMG
+else
+    DRIVE_ARG=if=ide,id=drive0,format=$IMGFMT,file=$TEST_IMG
+fi
+
+qemu_comm_method="monitor"
+_launch_qemu -drive $DRIVE_ARG -incoming defer
+h=$QEMU_HANDLE
+QEMU_COMM_TIMEOUT=1
+
+_send_qemu_cmd $h "nbd_server_start unix:$TEST_DIR/nbd" "(qemu)"
+_send_qemu_cmd $h "nbd_server_add -w drive0" "(qemu)"
+_send_qemu_cmd $h "q" "(qemu)"
 
 # success, all done
 echo "*** done"
-- 
2.13.5


Re: [Qemu-devel] [PATCH 1/2] iotests: rewrite 192 to use _launch_qemu to fix LUKS support
Posted by Eric Blake 8 years, 2 months ago
On 09/01/2017 05:54 AM, Daniel P. Berrange wrote:
> The LUKS driver requires extra args to QEMU to setup passwords.
> The _launch_qemu function takes care of this, so convert the
> test to use this function and use correct -drive syntax
> 
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
>  tests/qemu-iotests/192 | 23 ++++++++++++++++-------
>  1 file changed, 16 insertions(+), 7 deletions(-)
> 

>  
> -{
> -echo "nbd_server_start unix:$TEST_DIR/nbd"
> -echo "nbd_server_add -w drive0"
> -echo "q"
> -} | $QEMU -nodefaults -display none -monitor stdio \
> -    -drive format=$IMGFMT,file=$TEST_IMG,if=ide,id=drive0 \
> -    -incoming defer 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp

Can this test use QMP instead of HMP? But that's an independent question.

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Re: [Qemu-devel] [PATCH 1/2] iotests: rewrite 192 to use _launch_qemu to fix LUKS support
Posted by Kevin Wolf 8 years, 1 month ago
Am 01.09.2017 um 16:22 hat Eric Blake geschrieben:
> On 09/01/2017 05:54 AM, Daniel P. Berrange wrote:
> > The LUKS driver requires extra args to QEMU to setup passwords.
> > The _launch_qemu function takes care of this, so convert the
> > test to use this function and use correct -drive syntax
> > 
> > Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> > ---
> >  tests/qemu-iotests/192 | 23 ++++++++++++++++-------
> >  1 file changed, 16 insertions(+), 7 deletions(-)
> > 
> 
> >  
> > -{
> > -echo "nbd_server_start unix:$TEST_DIR/nbd"
> > -echo "nbd_server_add -w drive0"
> > -echo "q"
> > -} | $QEMU -nodefaults -display none -monitor stdio \
> > -    -drive format=$IMGFMT,file=$TEST_IMG,if=ide,id=drive0 \
> > -    -incoming defer 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp
> 
> Can this test use QMP instead of HMP? But that's an independent question.

As far as I am concerned, there is nothing wrong with having HMP tests.
HMP commands already call QMP internally (except for the generic QMP
code path below the command handlers), so using HMP actually increases
the test coverage in most cases. We should try to have a good mix of
test cases using QMP and test cases using HMP.

Kevin