0a122b
From 6b1816a687831a1622637ed10605759d9e90aa9c Mon Sep 17 00:00:00 2001
0a122b
From: Kevin Wolf <kwolf@redhat.com>
0a122b
Date: Tue, 25 Feb 2014 15:00:05 +0100
0a122b
Subject: [PATCH 7/7] qemu-iotests: Check qemu-img command line parsing
0a122b
0a122b
RH-Author: Kevin Wolf <kwolf@redhat.com>
0a122b
Message-id: <1393340405-9936-7-git-send-email-kwolf@redhat.com>
0a122b
Patchwork-id: 57798
0a122b
O-Subject: [RHEL-7.0 qemu-kvm PATCH 6/6] qemu-iotests: Check qemu-img command line parsing
0a122b
Bugzilla: 1065873
0a122b
RH-Acked-by: Juan Quintela <quintela@redhat.com>
0a122b
RH-Acked-by: Fam Zheng <famz@redhat.com>
0a122b
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
Reviewed-by: Jeff Cody <jcody@redhat.com>
0a122b
Reviewed-by: Eric Blake <eblake@redhat.com>
0a122b
(cherry picked from commit a33cc31d08eb46ec2a4f214087c99e4bd4c907e9)
0a122b
0a122b
Changed reference test output for RHEL 7, which has different error
0a122b
messages than upstream.
0a122b
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
---
0a122b
 tests/qemu-iotests/082     | 208 ++++++++++++++++++
0a122b
 tests/qemu-iotests/082.out | 529 +++++++++++++++++++++++++++++++++++++++++++++
0a122b
 tests/qemu-iotests/group   |   1 +
0a122b
 3 files changed, 738 insertions(+)
0a122b
 create mode 100755 tests/qemu-iotests/082
0a122b
 create mode 100644 tests/qemu-iotests/082.out
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 tests/qemu-iotests/082     |  208 +++++++++++++++++
0a122b
 tests/qemu-iotests/082.out |  529 ++++++++++++++++++++++++++++++++++++++++++++
0a122b
 tests/qemu-iotests/group   |    1 +
0a122b
 3 files changed, 738 insertions(+), 0 deletions(-)
0a122b
 create mode 100755 tests/qemu-iotests/082
0a122b
 create mode 100644 tests/qemu-iotests/082.out
0a122b
0a122b
diff --git a/tests/qemu-iotests/082 b/tests/qemu-iotests/082
0a122b
new file mode 100755
0a122b
index 0000000..f6eb75f
0a122b
--- /dev/null
0a122b
+++ b/tests/qemu-iotests/082
0a122b
@@ -0,0 +1,208 @@
0a122b
+#!/bin/bash
0a122b
+#
0a122b
+# Test qemu-img command line parsing
0a122b
+#
0a122b
+# Copyright (C) 2014 Red Hat, Inc.
0a122b
+#
0a122b
+# This program is free software; you can redistribute it and/or modify
0a122b
+# it under the terms of the GNU General Public License as published by
0a122b
+# the Free Software Foundation; either version 2 of the License, or
0a122b
+# (at your option) any later version.
0a122b
+#
0a122b
+# This program is distributed in the hope that it will be useful,
0a122b
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
0a122b
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0a122b
+# GNU General Public License for more details.
0a122b
+#
0a122b
+# You should have received a copy of the GNU General Public License
0a122b
+# along with this program.  If not, see <http: www.gnu.org="" licenses=""/>.
0a122b
+#
0a122b
+
0a122b
+# creator
0a122b
+owner=kwolf@redhat.com
0a122b
+
0a122b
+seq=`basename $0`
0a122b
+echo "QA output created by $seq"
0a122b
+
0a122b
+here=`pwd`
0a122b
+tmp=/tmp/$$
0a122b
+status=1	# failure is the default!
0a122b
+
0a122b
+_cleanup()
0a122b
+{
0a122b
+	_cleanup_test_img
0a122b
+}
0a122b
+trap "_cleanup; exit \$status" 0 1 2 3 15
0a122b
+
0a122b
+# get standard environment, filters and checks
0a122b
+. ./common.rc
0a122b
+. ./common.filter
0a122b
+
0a122b
+_supported_fmt qcow2
0a122b
+_supported_proto file
0a122b
+_supported_os Linux
0a122b
+
0a122b
+function run_qemu_img()
0a122b
+{
0a122b
+    echo
0a122b
+    echo Testing: "$@" | _filter_testdir
0a122b
+    "$QEMU_IMG" "$@" 2>&1 | _filter_testdir
0a122b
+}
0a122b
+
0a122b
+size=128M
0a122b
+
0a122b
+echo
0a122b
+echo === create: Options specified more than once ===
0a122b
+
0a122b
+# Last -f should win
0a122b
+run_qemu_img create -f foo -f $IMGFMT "$TEST_IMG" $size
0a122b
+run_qemu_img info "$TEST_IMG"
0a122b
+
0a122b
+# Multiple -o should be merged
0a122b
+run_qemu_img create -f $IMGFMT -o cluster_size=4k -o lazy_refcounts=on "$TEST_IMG" $size
0a122b
+run_qemu_img info "$TEST_IMG"
0a122b
+
0a122b
+# If the same -o key is specified more than once, the last one wins
0a122b
+run_qemu_img create -f $IMGFMT -o cluster_size=4k -o lazy_refcounts=on -o cluster_size=8k "$TEST_IMG" $size
0a122b
+run_qemu_img info "$TEST_IMG"
0a122b
+run_qemu_img create -f $IMGFMT -o cluster_size=4k,cluster_size=8k "$TEST_IMG" $size
0a122b
+run_qemu_img info "$TEST_IMG"
0a122b
+
0a122b
+echo
0a122b
+echo === create: help for -o ===
0a122b
+
0a122b
+# Adding the help option to a command without other -o options
0a122b
+run_qemu_img create -f $IMGFMT -o help "$TEST_IMG" $size
0a122b
+run_qemu_img create -f $IMGFMT -o \? "$TEST_IMG" $size
0a122b
+
0a122b
+# Adding the help option to the same -o option
0a122b
+run_qemu_img create -f $IMGFMT -o cluster_size=4k,help "$TEST_IMG" $size
0a122b
+run_qemu_img create -f $IMGFMT -o cluster_size=4k,\? "$TEST_IMG" $size
0a122b
+run_qemu_img create -f $IMGFMT -o help,cluster_size=4k "$TEST_IMG" $size
0a122b
+run_qemu_img create -f $IMGFMT -o \?,cluster_size=4k "$TEST_IMG" $size
0a122b
+
0a122b
+# Adding the help option to a separate -o option
0a122b
+run_qemu_img create -f $IMGFMT -o cluster_size=4k -o help "$TEST_IMG" $size
0a122b
+run_qemu_img create -f $IMGFMT -o cluster_size=4k -o \? "$TEST_IMG" $size
0a122b
+
0a122b
+# Looks like a help option, but is part of the backing file name
0a122b
+run_qemu_img create -f $IMGFMT -o backing_file="$TEST_IMG",,help "$TEST_IMG" $size
0a122b
+run_qemu_img create -f $IMGFMT -o backing_file="$TEST_IMG",,\? "$TEST_IMG" $size
0a122b
+
0a122b
+# Try to trick qemu-img into creating escaped commas
0a122b
+run_qemu_img create -f $IMGFMT -o backing_file="$TEST_IMG", -o help "$TEST_IMG" $size
0a122b
+run_qemu_img create -f $IMGFMT -o backing_file="$TEST_IMG" -o ,help "$TEST_IMG" $size
0a122b
+run_qemu_img create -f $IMGFMT -o backing_file="$TEST_IMG" -o ,, -o help "$TEST_IMG" $size
0a122b
+
0a122b
+# Leave out everything that isn't needed
0a122b
+run_qemu_img create -f $IMGFMT -o help
0a122b
+run_qemu_img create -o help
0a122b
+
0a122b
+echo
0a122b
+echo === convert: Options specified more than once ===
0a122b
+
0a122b
+# We need a valid source image
0a122b
+run_qemu_img create -f $IMGFMT "$TEST_IMG" $size
0a122b
+
0a122b
+# Last -f should win
0a122b
+run_qemu_img convert -f foo -f $IMGFMT "$TEST_IMG" "$TEST_IMG".base
0a122b
+run_qemu_img info "$TEST_IMG".base
0a122b
+
0a122b
+# Last -O should win
0a122b
+run_qemu_img convert -O foo -O $IMGFMT "$TEST_IMG" "$TEST_IMG".base
0a122b
+run_qemu_img info "$TEST_IMG".base
0a122b
+
0a122b
+# Multiple -o should be merged
0a122b
+run_qemu_img convert -O $IMGFMT -o cluster_size=4k -o lazy_refcounts=on "$TEST_IMG" "$TEST_IMG".base
0a122b
+run_qemu_img info "$TEST_IMG".base
0a122b
+
0a122b
+# If the same -o key is specified more than once, the last one wins
0a122b
+run_qemu_img convert -O $IMGFMT -o cluster_size=4k -o lazy_refcounts=on -o cluster_size=8k "$TEST_IMG" "$TEST_IMG".base
0a122b
+run_qemu_img info "$TEST_IMG".base
0a122b
+run_qemu_img convert -O $IMGFMT -o cluster_size=4k,cluster_size=8k "$TEST_IMG" "$TEST_IMG".base
0a122b
+run_qemu_img info "$TEST_IMG".base
0a122b
+
0a122b
+echo
0a122b
+echo === convert: help for -o ===
0a122b
+
0a122b
+# Adding the help option to a command without other -o options
0a122b
+run_qemu_img convert -O $IMGFMT -o help "$TEST_IMG" "$TEST_IMG".base
0a122b
+run_qemu_img convert -O $IMGFMT -o \? "$TEST_IMG" "$TEST_IMG".base
0a122b
+
0a122b
+# Adding the help option to the same -o option
0a122b
+run_qemu_img convert -O $IMGFMT -o cluster_size=4k,help "$TEST_IMG" "$TEST_IMG".base
0a122b
+run_qemu_img convert -O $IMGFMT -o cluster_size=4k,\? "$TEST_IMG" "$TEST_IMG".base
0a122b
+run_qemu_img convert -O $IMGFMT -o help,cluster_size=4k "$TEST_IMG" "$TEST_IMG".base
0a122b
+run_qemu_img convert -O $IMGFMT -o \?,cluster_size=4k "$TEST_IMG" "$TEST_IMG".base
0a122b
+
0a122b
+# Adding the help option to a separate -o option
0a122b
+run_qemu_img convert -O $IMGFMT -o cluster_size=4k -o help "$TEST_IMG" "$TEST_IMG".base
0a122b
+run_qemu_img convert -O $IMGFMT -o cluster_size=4k -o \? "$TEST_IMG" "$TEST_IMG".base
0a122b
+
0a122b
+# Looks like a help option, but is part of the backing file name
0a122b
+run_qemu_img convert -O $IMGFMT -o backing_file="$TEST_IMG",,help "$TEST_IMG" "$TEST_IMG".base
0a122b
+run_qemu_img convert -O $IMGFMT -o backing_file="$TEST_IMG",,\? "$TEST_IMG" "$TEST_IMG".base
0a122b
+
0a122b
+# Try to trick qemu-img into creating escaped commas
0a122b
+run_qemu_img convert -O $IMGFMT -o backing_file="$TEST_IMG", -o help "$TEST_IMG" "$TEST_IMG".base
0a122b
+run_qemu_img convert -O $IMGFMT -o backing_file="$TEST_IMG" -o ,help "$TEST_IMG" "$TEST_IMG".base
0a122b
+run_qemu_img convert -O $IMGFMT -o backing_file="$TEST_IMG" -o ,, -o help "$TEST_IMG" "$TEST_IMG".base
0a122b
+
0a122b
+# Leave out everything that isn't needed
0a122b
+run_qemu_img convert -O $IMGFMT -o help
0a122b
+run_qemu_img convert -o help
0a122b
+
0a122b
+echo
0a122b
+echo === amend: Options specified more than once ===
0a122b
+
0a122b
+# Last -f should win
0a122b
+run_qemu_img amend -f foo -f $IMGFMT -o lazy_refcounts=on "$TEST_IMG"
0a122b
+run_qemu_img info "$TEST_IMG"
0a122b
+
0a122b
+# Multiple -o should be merged
0a122b
+run_qemu_img amend -f $IMGFMT -o size=130M -o lazy_refcounts=off "$TEST_IMG"
0a122b
+run_qemu_img info "$TEST_IMG"
0a122b
+
0a122b
+# If the same -o key is specified more than once, the last one wins
0a122b
+run_qemu_img amend -f $IMGFMT -o size=8M -o lazy_refcounts=on -o size=132M "$TEST_IMG"
0a122b
+run_qemu_img info "$TEST_IMG"
0a122b
+run_qemu_img amend -f $IMGFMT -o size=4M,size=148M "$TEST_IMG"
0a122b
+run_qemu_img info "$TEST_IMG"
0a122b
+
0a122b
+echo
0a122b
+echo === amend: help for -o ===
0a122b
+
0a122b
+# Adding the help option to a command without other -o options
0a122b
+run_qemu_img amend -f $IMGFMT -o help "$TEST_IMG"
0a122b
+run_qemu_img amend -f $IMGFMT -o \? "$TEST_IMG"
0a122b
+
0a122b
+# Adding the help option to the same -o option
0a122b
+run_qemu_img amend -f $IMGFMT -o cluster_size=4k,help "$TEST_IMG"
0a122b
+run_qemu_img amend -f $IMGFMT -o cluster_size=4k,\? "$TEST_IMG"
0a122b
+run_qemu_img amend -f $IMGFMT -o help,cluster_size=4k "$TEST_IMG"
0a122b
+run_qemu_img amend -f $IMGFMT -o \?,cluster_size=4k "$TEST_IMG"
0a122b
+
0a122b
+# Adding the help option to a separate -o option
0a122b
+run_qemu_img amend -f $IMGFMT -o cluster_size=4k -o help "$TEST_IMG"
0a122b
+run_qemu_img amend -f $IMGFMT -o cluster_size=4k -o \? "$TEST_IMG"
0a122b
+
0a122b
+# Looks like a help option, but is part of the backing file name
0a122b
+run_qemu_img amend -f $IMGFMT -o backing_file="$TEST_IMG",,help "$TEST_IMG"
0a122b
+run_qemu_img rebase -u -b "" -f $IMGFMT "$TEST_IMG"
0a122b
+
0a122b
+run_qemu_img amend -f $IMGFMT -o backing_file="$TEST_IMG",,\? "$TEST_IMG"
0a122b
+run_qemu_img rebase -u -b "" -f $IMGFMT "$TEST_IMG"
0a122b
+
0a122b
+# Try to trick qemu-img into creating escaped commas
0a122b
+run_qemu_img amend -f $IMGFMT -o backing_file="$TEST_IMG", -o help "$TEST_IMG"
0a122b
+run_qemu_img amend -f $IMGFMT -o backing_file="$TEST_IMG" -o ,help "$TEST_IMG"
0a122b
+run_qemu_img amend -f $IMGFMT -o backing_file="$TEST_IMG" -o ,, -o help "$TEST_IMG"
0a122b
+
0a122b
+# Leave out everything that isn't needed
0a122b
+run_qemu_img amend -f $IMGFMT -o help
0a122b
+run_qemu_img convert -o help
0a122b
+
0a122b
+# success, all done
0a122b
+echo "*** done"
0a122b
+rm -f $seq.full
0a122b
+status=0
0a122b
diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out
0a122b
new file mode 100644
0a122b
index 0000000..d71610b
0a122b
--- /dev/null
0a122b
+++ b/tests/qemu-iotests/082.out
0a122b
@@ -0,0 +1,529 @@
0a122b
+QA output created by 082
0a122b
+
0a122b
+=== create: Options specified more than once ===
0a122b
+
0a122b
+Testing: create -f foo -f qcow2 TEST_DIR/t.qcow2 128M
0a122b
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 encryption=off cluster_size=65536 lazy_refcounts=off 
0a122b
+
0a122b
+Testing: info TEST_DIR/t.qcow2
0a122b
+image: TEST_DIR/t.qcow2
0a122b
+file format: qcow2
0a122b
+virtual size: 128M (134217728 bytes)
0a122b
+disk size: 196K
0a122b
+cluster_size: 65536
0a122b
+Format specific information:
0a122b
+    compat: 1.1
0a122b
+    lazy refcounts: false
0a122b
+
0a122b
+Testing: create -f qcow2 -o cluster_size=4k -o lazy_refcounts=on TEST_DIR/t.qcow2 128M
0a122b
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 encryption=off cluster_size=4096 lazy_refcounts=on 
0a122b
+
0a122b
+Testing: info TEST_DIR/t.qcow2
0a122b
+image: TEST_DIR/t.qcow2
0a122b
+file format: qcow2
0a122b
+virtual size: 128M (134217728 bytes)
0a122b
+disk size: 16K
0a122b
+cluster_size: 4096
0a122b
+Format specific information:
0a122b
+    compat: 1.1
0a122b
+    lazy refcounts: true
0a122b
+
0a122b
+Testing: create -f qcow2 -o cluster_size=4k -o lazy_refcounts=on -o cluster_size=8k TEST_DIR/t.qcow2 128M
0a122b
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 encryption=off cluster_size=8192 lazy_refcounts=on 
0a122b
+
0a122b
+Testing: info TEST_DIR/t.qcow2
0a122b
+image: TEST_DIR/t.qcow2
0a122b
+file format: qcow2
0a122b
+virtual size: 128M (134217728 bytes)
0a122b
+disk size: 28K
0a122b
+cluster_size: 8192
0a122b
+Format specific information:
0a122b
+    compat: 1.1
0a122b
+    lazy refcounts: true
0a122b
+
0a122b
+Testing: create -f qcow2 -o cluster_size=4k,cluster_size=8k TEST_DIR/t.qcow2 128M
0a122b
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 encryption=off cluster_size=8192 lazy_refcounts=off 
0a122b
+
0a122b
+Testing: info TEST_DIR/t.qcow2
0a122b
+image: TEST_DIR/t.qcow2
0a122b
+file format: qcow2
0a122b
+virtual size: 128M (134217728 bytes)
0a122b
+disk size: 28K
0a122b
+cluster_size: 8192
0a122b
+Format specific information:
0a122b
+    compat: 1.1
0a122b
+    lazy refcounts: false
0a122b
+
0a122b
+=== create: help for -o ===
0a122b
+
0a122b
+Testing: create -f qcow2 -o help TEST_DIR/t.qcow2 128M
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: create -f qcow2 -o ? TEST_DIR/t.qcow2 128M
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: create -f qcow2 -o cluster_size=4k,help TEST_DIR/t.qcow2 128M
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: create -f qcow2 -o cluster_size=4k,? TEST_DIR/t.qcow2 128M
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: create -f qcow2 -o help,cluster_size=4k TEST_DIR/t.qcow2 128M
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: create -f qcow2 -o ?,cluster_size=4k TEST_DIR/t.qcow2 128M
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: create -f qcow2 -o cluster_size=4k -o help TEST_DIR/t.qcow2 128M
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: create -f qcow2 -o cluster_size=4k -o ? TEST_DIR/t.qcow2 128M
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: create -f qcow2 -o backing_file=TEST_DIR/t.qcow2,,help TEST_DIR/t.qcow2 128M
0a122b
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 backing_file='TEST_DIR/t.qcow2,help' encryption=off cluster_size=65536 lazy_refcounts=off 
0a122b
+
0a122b
+Testing: create -f qcow2 -o backing_file=TEST_DIR/t.qcow2,,? TEST_DIR/t.qcow2 128M
0a122b
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 backing_file='TEST_DIR/t.qcow2,?' encryption=off cluster_size=65536 lazy_refcounts=off 
0a122b
+
0a122b
+Testing: create -f qcow2 -o backing_file=TEST_DIR/t.qcow2, -o help TEST_DIR/t.qcow2 128M
0a122b
+qemu-img: Invalid option list: backing_file=TEST_DIR/t.qcow2,
0a122b
+
0a122b
+Testing: create -f qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,help TEST_DIR/t.qcow2 128M
0a122b
+qemu-img: Invalid option list: ,help
0a122b
+
0a122b
+Testing: create -f qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,, -o help TEST_DIR/t.qcow2 128M
0a122b
+qemu-img: Invalid option list: ,,
0a122b
+
0a122b
+Testing: create -f qcow2 -o help
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: create -o help
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+
0a122b
+=== convert: Options specified more than once ===
0a122b
+
0a122b
+Testing: create -f qcow2 TEST_DIR/t.qcow2 128M
0a122b
+Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 encryption=off cluster_size=65536 lazy_refcounts=off 
0a122b
+
0a122b
+Testing: convert -f foo -f qcow2 TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+
0a122b
+Testing: info TEST_DIR/t.qcow2.base
0a122b
+image: TEST_DIR/t.qcow2.base
0a122b
+file format: raw
0a122b
+virtual size: 128M (134217728 bytes)
0a122b
+disk size: 0
0a122b
+
0a122b
+Testing: convert -O foo -O qcow2 TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+
0a122b
+Testing: info TEST_DIR/t.qcow2.base
0a122b
+image: TEST_DIR/t.qcow2.base
0a122b
+file format: qcow2
0a122b
+virtual size: 128M (134217728 bytes)
0a122b
+disk size: 196K
0a122b
+cluster_size: 65536
0a122b
+Format specific information:
0a122b
+    compat: 1.1
0a122b
+    lazy refcounts: false
0a122b
+
0a122b
+Testing: convert -O qcow2 -o cluster_size=4k -o lazy_refcounts=on TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+
0a122b
+Testing: info TEST_DIR/t.qcow2.base
0a122b
+image: TEST_DIR/t.qcow2.base
0a122b
+file format: qcow2
0a122b
+virtual size: 128M (134217728 bytes)
0a122b
+disk size: 16K
0a122b
+cluster_size: 4096
0a122b
+Format specific information:
0a122b
+    compat: 1.1
0a122b
+    lazy refcounts: true
0a122b
+
0a122b
+Testing: convert -O qcow2 -o cluster_size=4k -o lazy_refcounts=on -o cluster_size=8k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+
0a122b
+Testing: info TEST_DIR/t.qcow2.base
0a122b
+image: TEST_DIR/t.qcow2.base
0a122b
+file format: qcow2
0a122b
+virtual size: 128M (134217728 bytes)
0a122b
+disk size: 28K
0a122b
+cluster_size: 8192
0a122b
+Format specific information:
0a122b
+    compat: 1.1
0a122b
+    lazy refcounts: true
0a122b
+
0a122b
+Testing: convert -O qcow2 -o cluster_size=4k,cluster_size=8k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+
0a122b
+Testing: info TEST_DIR/t.qcow2.base
0a122b
+image: TEST_DIR/t.qcow2.base
0a122b
+file format: qcow2
0a122b
+virtual size: 128M (134217728 bytes)
0a122b
+disk size: 28K
0a122b
+cluster_size: 8192
0a122b
+Format specific information:
0a122b
+    compat: 1.1
0a122b
+    lazy refcounts: false
0a122b
+
0a122b
+=== convert: help for -o ===
0a122b
+
0a122b
+Testing: convert -O qcow2 -o help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: convert -O qcow2 -o ? TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: convert -O qcow2 -o cluster_size=4k,help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: convert -O qcow2 -o cluster_size=4k,? TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: convert -O qcow2 -o help,cluster_size=4k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: convert -O qcow2 -o ?,cluster_size=4k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: convert -O qcow2 -o cluster_size=4k -o help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: convert -O qcow2 -o cluster_size=4k -o ? TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: convert -O qcow2 -o backing_file=TEST_DIR/t.qcow2,,help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+qemu-img: Could not open 'TEST_DIR/t.qcow2.base': Could not open file: No such file or directory
0a122b
+
0a122b
+Testing: convert -O qcow2 -o backing_file=TEST_DIR/t.qcow2,,? TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+qemu-img: Could not open 'TEST_DIR/t.qcow2.base': Could not open file: No such file or directory
0a122b
+
0a122b
+Testing: convert -O qcow2 -o backing_file=TEST_DIR/t.qcow2, -o help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+qemu-img: Invalid option list: backing_file=TEST_DIR/t.qcow2,
0a122b
+
0a122b
+Testing: convert -O qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+qemu-img: Invalid option list: ,help
0a122b
+
0a122b
+Testing: convert -O qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,, -o help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
0a122b
+qemu-img: Invalid option list: ,,
0a122b
+
0a122b
+Testing: convert -O qcow2 -o help
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: convert -o help
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+
0a122b
+=== amend: Options specified more than once ===
0a122b
+
0a122b
+Testing: amend -f foo -f qcow2 -o lazy_refcounts=on TEST_DIR/t.qcow2
0a122b
+
0a122b
+Testing: info TEST_DIR/t.qcow2
0a122b
+image: TEST_DIR/t.qcow2
0a122b
+file format: qcow2
0a122b
+virtual size: 128M (134217728 bytes)
0a122b
+disk size: 196K
0a122b
+cluster_size: 65536
0a122b
+Format specific information:
0a122b
+    compat: 1.1
0a122b
+    lazy refcounts: true
0a122b
+
0a122b
+Testing: amend -f qcow2 -o size=130M -o lazy_refcounts=off TEST_DIR/t.qcow2
0a122b
+
0a122b
+Testing: info TEST_DIR/t.qcow2
0a122b
+image: TEST_DIR/t.qcow2
0a122b
+file format: qcow2
0a122b
+virtual size: 130M (136314880 bytes)
0a122b
+disk size: 196K
0a122b
+cluster_size: 65536
0a122b
+Format specific information:
0a122b
+    compat: 1.1
0a122b
+    lazy refcounts: false
0a122b
+
0a122b
+Testing: amend -f qcow2 -o size=8M -o lazy_refcounts=on -o size=132M TEST_DIR/t.qcow2
0a122b
+
0a122b
+Testing: info TEST_DIR/t.qcow2
0a122b
+image: TEST_DIR/t.qcow2
0a122b
+file format: qcow2
0a122b
+virtual size: 132M (138412032 bytes)
0a122b
+disk size: 196K
0a122b
+cluster_size: 65536
0a122b
+Format specific information:
0a122b
+    compat: 1.1
0a122b
+    lazy refcounts: true
0a122b
+
0a122b
+Testing: amend -f qcow2 -o size=4M,size=148M TEST_DIR/t.qcow2
0a122b
+
0a122b
+Testing: info TEST_DIR/t.qcow2
0a122b
+image: TEST_DIR/t.qcow2
0a122b
+file format: qcow2
0a122b
+virtual size: 148M (155189248 bytes)
0a122b
+disk size: 196K
0a122b
+cluster_size: 65536
0a122b
+Format specific information:
0a122b
+    compat: 1.1
0a122b
+    lazy refcounts: true
0a122b
+
0a122b
+=== amend: help for -o ===
0a122b
+
0a122b
+Testing: amend -f qcow2 -o help TEST_DIR/t.qcow2
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: amend -f qcow2 -o ? TEST_DIR/t.qcow2
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: amend -f qcow2 -o cluster_size=4k,help TEST_DIR/t.qcow2
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: amend -f qcow2 -o cluster_size=4k,? TEST_DIR/t.qcow2
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: amend -f qcow2 -o help,cluster_size=4k TEST_DIR/t.qcow2
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: amend -f qcow2 -o ?,cluster_size=4k TEST_DIR/t.qcow2
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: amend -f qcow2 -o cluster_size=4k -o help TEST_DIR/t.qcow2
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: amend -f qcow2 -o cluster_size=4k -o ? TEST_DIR/t.qcow2
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: amend -f qcow2 -o backing_file=TEST_DIR/t.qcow2,,help TEST_DIR/t.qcow2
0a122b
+
0a122b
+Testing: rebase -u -b  -f qcow2 TEST_DIR/t.qcow2
0a122b
+
0a122b
+Testing: amend -f qcow2 -o backing_file=TEST_DIR/t.qcow2,,? TEST_DIR/t.qcow2
0a122b
+
0a122b
+Testing: rebase -u -b  -f qcow2 TEST_DIR/t.qcow2
0a122b
+
0a122b
+Testing: amend -f qcow2 -o backing_file=TEST_DIR/t.qcow2, -o help TEST_DIR/t.qcow2
0a122b
+qemu-img: Invalid option list: backing_file=TEST_DIR/t.qcow2,
0a122b
+
0a122b
+Testing: amend -f qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,help TEST_DIR/t.qcow2
0a122b
+qemu-img: Invalid option list: ,help
0a122b
+
0a122b
+Testing: amend -f qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,, -o help TEST_DIR/t.qcow2
0a122b
+qemu-img: Invalid option list: ,,
0a122b
+
0a122b
+Testing: amend -f qcow2 -o help
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+compat           Compatibility level (0.10 or 1.1)
0a122b
+backing_file     File name of a base image
0a122b
+backing_fmt      Image format of the base image
0a122b
+encryption       Encrypt the image
0a122b
+cluster_size     qcow2 cluster size
0a122b
+preallocation    Preallocation mode (allowed values: off, metadata)
0a122b
+lazy_refcounts   Postpone refcount updates
0a122b
+
0a122b
+Testing: convert -o help
0a122b
+Supported options:
0a122b
+size             Virtual disk size
0a122b
+*** done
0a122b
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
0a122b
index fce6ca8..ee95d6e 100644
0a122b
--- a/tests/qemu-iotests/group
0a122b
+++ b/tests/qemu-iotests/group
0a122b
@@ -73,3 +73,4 @@
0a122b
 070 rw auto
0a122b
 077 rw auto
0a122b
 079 rw auto
0a122b
+082 rw auto quick
0a122b
-- 
0a122b
1.7.1
0a122b