]> git.proxmox.com Git - qemu.git/commitdiff
qemu-iotests: Fix call syntax for qemu-img
authorStefan Weil <sw@weilnetz.de>
Wed, 14 Mar 2012 18:57:23 +0000 (19:57 +0100)
committerKevin Wolf <kwolf@redhat.com>
Thu, 5 Apr 2012 13:08:22 +0000 (15:08 +0200)
qemu-img requires first options, then file name, then size.

GNU getopt also allows options at the end, but POSIX getopt
doesn't. Try "export POSIXLY_CORRECT=y" to get the POSIX
behaviour with GNU getopt, too.

Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
tests/qemu-iotests/common.rc

index 26811ca660b65a8c8d4a9a9106c2ea37e7313465..4cb8dae8c628c46f011fec1274aa2b0a21f2a2db 100644 (file)
@@ -57,16 +57,21 @@ _make_test_img()
 {
     # extra qemu-img options can be added by tests
     # at least one argument (the image size) needs to be added
-    local extra_img_options=$*
+    local extra_img_options=""
     local cluster_size_filter="s# cluster_size=[0-9]\\+##g"
+    local image_size=$*
 
+    if [ "$1" = "-b" ]; then
+        extra_img_options="$1 $2"
+        image_size=$3
+    fi
     if [ \( "$IMGFMT" = "qcow2" -o "$IMGFMT" = "qed" \) -a -n "$CLUSTER_SIZE" ]; then
         extra_img_options="-o cluster_size=$CLUSTER_SIZE $extra_img_options"
         cluster_size_filter=""
     fi
 
     # XXX(hch): have global image options?
-    $QEMU_IMG create -f $IMGFMT $TEST_IMG $extra_img_options | \
+    $QEMU_IMG create -f $IMGFMT $extra_img_options $TEST_IMG $image_size | \
        sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" | \
        sed -e "s#$TEST_DIR#TEST_DIR#g" | \
        sed -e "s#$IMGFMT#IMGFMT#g" | \