diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check-qdict.c | 75 | ||||
-rwxr-xr-x | tests/qemu-iotests/046 | 18 | ||||
-rw-r--r-- | tests/qemu-iotests/051.out | 4 | ||||
-rw-r--r-- | tests/qemu-iotests/059.out | 6 | ||||
-rwxr-xr-x | tests/qemu-iotests/081 | 146 | ||||
-rw-r--r-- | tests/qemu-iotests/081.out | 49 | ||||
-rwxr-xr-x | tests/qemu-iotests/082 | 208 | ||||
-rw-r--r-- | tests/qemu-iotests/082.out | 529 | ||||
-rw-r--r-- | tests/qemu-iotests/group | 2 |
9 files changed, 1021 insertions, 16 deletions
diff --git a/tests/check-qdict.c b/tests/check-qdict.c index 7a7461b0b2..2ad0f7827e 100644 --- a/tests/check-qdict.c +++ b/tests/check-qdict.c @@ -306,6 +306,7 @@ static void qdict_array_split_test(void) { QDict *test_dict = qdict_new(); QDict *dict1, *dict2; + QInt *int1; QList *test_list; /* @@ -313,10 +314,11 @@ static void qdict_array_split_test(void) * * { * "1.x": 0, - * "3.y": 1, + * "4.y": 1, * "0.a": 42, * "o.o": 7, - * "0.b": 23 + * "0.b": 23, + * "2": 66 * } * * to @@ -328,13 +330,14 @@ static void qdict_array_split_test(void) * }, * { * "x": 0 - * } + * }, + * 66 * ] * * and * * { - * "3.y": 1, + * "4.y": 1, * "o.o": 7 * } * @@ -344,18 +347,21 @@ static void qdict_array_split_test(void) */ qdict_put(test_dict, "1.x", qint_from_int(0)); - qdict_put(test_dict, "3.y", qint_from_int(1)); + qdict_put(test_dict, "4.y", qint_from_int(1)); qdict_put(test_dict, "0.a", qint_from_int(42)); qdict_put(test_dict, "o.o", qint_from_int(7)); qdict_put(test_dict, "0.b", qint_from_int(23)); + qdict_put(test_dict, "2", qint_from_int(66)); qdict_array_split(test_dict, &test_list); dict1 = qobject_to_qdict(qlist_pop(test_list)); dict2 = qobject_to_qdict(qlist_pop(test_list)); + int1 = qobject_to_qint(qlist_pop(test_list)); g_assert(dict1); g_assert(dict2); + g_assert(int1); g_assert(qlist_empty(test_list)); QDECREF(test_list); @@ -373,12 +379,69 @@ static void qdict_array_split_test(void) QDECREF(dict2); - g_assert(qdict_get_int(test_dict, "3.y") == 1); + g_assert(qint_get_int(int1) == 66); + + QDECREF(int1); + + g_assert(qdict_get_int(test_dict, "4.y") == 1); g_assert(qdict_get_int(test_dict, "o.o") == 7); g_assert(qdict_size(test_dict) == 2); QDECREF(test_dict); + + + /* + * Test the split of + * + * { + * "0": 42, + * "1": 23, + * "1.x": 84 + * } + * + * to + * + * [ + * 42 + * ] + * + * and + * + * { + * "1": 23, + * "1.x": 84 + * } + * + * That is, test whether splitting stops if there is both an entry with key + * of "%u" and other entries with keys prefixed "%u." for the same index. + */ + + test_dict = qdict_new(); + + qdict_put(test_dict, "0", qint_from_int(42)); + qdict_put(test_dict, "1", qint_from_int(23)); + qdict_put(test_dict, "1.x", qint_from_int(84)); + + qdict_array_split(test_dict, &test_list); + + int1 = qobject_to_qint(qlist_pop(test_list)); + + g_assert(int1); + g_assert(qlist_empty(test_list)); + + QDECREF(test_list); + + g_assert(qint_get_int(int1) == 42); + + QDECREF(int1); + + g_assert(qdict_get_int(test_dict, "1") == 23); + g_assert(qdict_get_int(test_dict, "1.x") == 84); + + g_assert(qdict_size(test_dict) == 2); + + QDECREF(test_dict); } /* diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotests/046 index 2d44bbb187..e0be46cf2b 100755 --- a/tests/qemu-iotests/046 +++ b/tests/qemu-iotests/046 @@ -193,6 +193,16 @@ echo "== Verify image content ==" function verify_io() { + if ($QEMU_IMG info -f "$IMGFMT" "$TEST_IMG" | grep "compat: 0.10" > /dev/null); then + # For v2 images, discarded clusters are read from the backing file + # Keep the variable empty so that the backing file value can be used as + # the default below + discarded= + else + # Discarded clusters are zeroed for v3 or later + discarded=0 + fi + echo read -P 0 0 0x10000 echo read -P 1 0x10000 0x2000 @@ -221,16 +231,16 @@ function verify_io() echo read -P 70 0x78000 0x6000 echo read -P 7 0x7e000 0x2000 - echo read -P 8 0x80000 0x6000 + echo read -P ${discarded:-8} 0x80000 0x6000 echo read -P 80 0x86000 0x2000 - echo read -P 8 0x88000 0x2000 + echo read -P ${discarded:-8} 0x88000 0x2000 echo read -P 81 0x8a000 0xe000 echo read -P 90 0x98000 0x6000 echo read -P 9 0x9e000 0x2000 - echo read -P 10 0xa0000 0x6000 + echo read -P ${discarded:-10} 0xa0000 0x6000 echo read -P 100 0xa6000 0x2000 - echo read -P 10 0xa8000 0x2000 + echo read -P ${discarded:-10} 0xa8000 0x2000 echo read -P 101 0xaa000 0xe000 echo read -P 110 0xb8000 0x8000 diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out index 30e2dbd6d7..7de18704f8 100644 --- a/tests/qemu-iotests/051.out +++ b/tests/qemu-iotests/051.out @@ -231,7 +231,7 @@ Testing: -drive driver=file QEMU_PROG: -drive driver=file: could not open disk image ide0-hd0: The 'file' block driver requires a file name Testing: -drive driver=nbd -QEMU_PROG: -drive driver=nbd: could not open disk image ide0-hd0: Could not open image: Invalid argument +QEMU_PROG: -drive driver=nbd: could not open disk image ide0-hd0: one of path and host must be specified. Testing: -drive driver=raw QEMU_PROG: -drive driver=raw: could not open disk image ide0-hd0: Can't use 'raw' as a block driver for the protocol level @@ -240,7 +240,7 @@ Testing: -drive file.driver=file QEMU_PROG: -drive file.driver=file: could not open disk image ide0-hd0: The 'file' block driver requires a file name Testing: -drive file.driver=nbd -QEMU_PROG: -drive file.driver=nbd: could not open disk image ide0-hd0: Could not open image: Invalid argument +QEMU_PROG: -drive file.driver=nbd: could not open disk image ide0-hd0: one of path and host must be specified. Testing: -drive file.driver=raw QEMU_PROG: -drive file.driver=raw: could not open disk image ide0-hd0: Can't use 'raw' as a block driver for the protocol level diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out index 4ffeb54710..3371c867bb 100644 --- a/tests/qemu-iotests/059.out +++ b/tests/qemu-iotests/059.out @@ -7,8 +7,7 @@ no file open, try 'help open' === Testing too big L2 table size === Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 -L2 table size too big -qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type +qemu-io: can't open device TEST_DIR/t.vmdk: L2 table size too big no file open, try 'help open' === Testing too big L1 table size === @@ -2045,8 +2044,7 @@ RW 12582912 VMFS "dummy.IMGFMT" 1 === Testing truncated sparse === Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=107374182400 -qemu-img: File truncated, expecting at least 13172736 bytes -qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Could not open 'TEST_DIR/t.IMGFMT': Wrong medium type +qemu-img: Could not open 'TEST_DIR/t.IMGFMT': File truncated, expecting at least 13172736 bytes === Testing version 3 === image: TEST_DIR/iotest-version3.IMGFMT diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081 new file mode 100755 index 0000000000..f053f11942 --- /dev/null +++ b/tests/qemu-iotests/081 @@ -0,0 +1,146 @@ +#!/bin/bash +# +# Test Quorum block driver +# +# Copyright (C) 2013 Nodalink, SARL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +# creator +owner=benoit@irqsave.net + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! + +_cleanup() +{ + rm -rf $TEST_DIR/1.raw + rm -rf $TEST_DIR/2.raw + rm -rf $TEST_DIR/3.raw +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt raw +_supported_proto generic +_supported_os Linux + +function do_run_qemu() +{ + echo Testing: "$@" | _filter_imgfmt + $QEMU -nographic -qmp stdio -serial none "$@" + echo +} + +function run_qemu() +{ + do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp | _filter_qemu_io +} + +quorum="file.driver=quorum,file.children.0.file.filename=$TEST_DIR/1.raw" +quorum="$quorum,file.children.1.file.filename=$TEST_DIR/2.raw" +quorum="$quorum,file.children.2.file.filename=$TEST_DIR/3.raw,file.vote-threshold=2" + +echo +echo "== creating quorum files ==" + +size=10M + +TEST_IMG="$TEST_DIR/1.raw" _make_test_img $size +TEST_IMG="$TEST_DIR/2.raw" _make_test_img $size +TEST_IMG="$TEST_DIR/3.raw" _make_test_img $size + +echo +echo "== writing images ==" + +$QEMU_IO -c "open -o $quorum" -c "write -P 0x32 0 $size" | _filter_qemu_io + +echo +echo "== checking quorum write ==" + +$QEMU_IO -c "read -P 0x32 0 $size" "$TEST_DIR/1.raw" | _filter_qemu_io +$QEMU_IO -c "read -P 0x32 0 $size" "$TEST_DIR/2.raw" | _filter_qemu_io +$QEMU_IO -c "read -P 0x32 0 $size" "$TEST_DIR/3.raw" | _filter_qemu_io + +echo +echo "== corrupting image ==" + +$QEMU_IO -c "write -P 0x42 0 $size" "$TEST_DIR/2.raw" | _filter_qemu_io + +echo +echo "== checking quorum correction ==" + +$QEMU_IO -c "open -o $quorum" -c "read -P 0x32 0 $size" | _filter_qemu_io + +echo +echo "== checking mixed reference/option specification ==" + +run_qemu -drive "file=$TEST_DIR/2.raw,format=$IMGFMT,if=none,id=drive2" <<EOF +{ "execute": "qmp_capabilities" } +{ "execute": "blockdev-add", + "arguments": { + "options": { + "driver": "quorum", + "id": "drive0-quorum", + "vote-threshold": 2, + "children": [ + { + "driver": "raw", + "file": { + "driver": "file", + "filename": "$TEST_DIR/1.raw" + } + }, + "drive2", + { + "driver": "raw", + "file": { + "driver": "file", + "filename": "$TEST_DIR/3.raw" + } + } + ] + } + } +} +{ "execute": "human-monitor-command", + "arguments": { + "command-line": 'qemu-io drive0-quorum "read -P 0x32 0 $size"' + } +} +{ "execute": "quit" } +EOF + +echo +echo "== breaking quorum ==" + +$QEMU_IO -c "write -P 0x41 0 $size" "$TEST_DIR/1.raw" | _filter_qemu_io +echo +echo "== checking that quorum is broken ==" + +$QEMU_IO -c "open -o $quorum" -c "read -P 0x32 0 $size" | _filter_qemu_io + + +# success, all done +echo "*** done" +rm -f $seq.full +status=0 diff --git a/tests/qemu-iotests/081.out b/tests/qemu-iotests/081.out new file mode 100644 index 0000000000..4fe2f95f63 --- /dev/null +++ b/tests/qemu-iotests/081.out @@ -0,0 +1,49 @@ +QA output created by 081 + +== creating quorum files == +Formatting 'TEST_DIR/1.IMGFMT', fmt=IMGFMT size=10485760 +Formatting 'TEST_DIR/2.IMGFMT', fmt=IMGFMT size=10485760 +Formatting 'TEST_DIR/3.IMGFMT', fmt=IMGFMT size=10485760 + +== writing images == +wrote 10485760/10485760 bytes at offset 0 +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +== checking quorum write == +read 10485760/10485760 bytes at offset 0 +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 10485760/10485760 bytes at offset 0 +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 10485760/10485760 bytes at offset 0 +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +== corrupting image == +wrote 10485760/10485760 bytes at offset 0 +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +== checking quorum correction == +read 10485760/10485760 bytes at offset 0 +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +== checking mixed reference/option specification == +Testing: -drive file=TEST_DIR/2.IMGFMT,format=IMGFMT,if=none,id=drive2 +QMP_VERSION +{"return": {}} +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "QUORUM_REPORT_BAD", "data": {"node-name": "", "ret": 0, "sectors-count": 20480, "sector-num": 0}} +read 10485760/10485760 bytes at offset 0 +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +{"return": ""} +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "ide1-cd0", "tray-open": true}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "floppy0", "tray-open": true}} + + +== breaking quorum == +wrote 10485760/10485760 bytes at offset 0 +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +== checking that quorum is broken == +qemu-io: can't open device (null): Could not read image for determining its format: Input/output error +*** done diff --git a/tests/qemu-iotests/082 b/tests/qemu-iotests/082 new file mode 100755 index 0000000000..f6eb75f624 --- /dev/null +++ b/tests/qemu-iotests/082 @@ -0,0 +1,208 @@ +#!/bin/bash +# +# Test qemu-img command line parsing +# +# Copyright (C) 2014 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +# creator +owner=kwolf@redhat.com + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt qcow2 +_supported_proto file +_supported_os Linux + +function run_qemu_img() +{ + echo + echo Testing: "$@" | _filter_testdir + "$QEMU_IMG" "$@" 2>&1 | _filter_testdir +} + +size=128M + +echo +echo === create: Options specified more than once === + +# Last -f should win +run_qemu_img create -f foo -f $IMGFMT "$TEST_IMG" $size +run_qemu_img info "$TEST_IMG" + +# Multiple -o should be merged +run_qemu_img create -f $IMGFMT -o cluster_size=4k -o lazy_refcounts=on "$TEST_IMG" $size +run_qemu_img info "$TEST_IMG" + +# If the same -o key is specified more than once, the last one wins +run_qemu_img create -f $IMGFMT -o cluster_size=4k -o lazy_refcounts=on -o cluster_size=8k "$TEST_IMG" $size +run_qemu_img info "$TEST_IMG" +run_qemu_img create -f $IMGFMT -o cluster_size=4k,cluster_size=8k "$TEST_IMG" $size +run_qemu_img info "$TEST_IMG" + +echo +echo === create: help for -o === + +# Adding the help option to a command without other -o options +run_qemu_img create -f $IMGFMT -o help "$TEST_IMG" $size +run_qemu_img create -f $IMGFMT -o \? "$TEST_IMG" $size + +# Adding the help option to the same -o option +run_qemu_img create -f $IMGFMT -o cluster_size=4k,help "$TEST_IMG" $size +run_qemu_img create -f $IMGFMT -o cluster_size=4k,\? "$TEST_IMG" $size +run_qemu_img create -f $IMGFMT -o help,cluster_size=4k "$TEST_IMG" $size +run_qemu_img create -f $IMGFMT -o \?,cluster_size=4k "$TEST_IMG" $size + +# Adding the help option to a separate -o option +run_qemu_img create -f $IMGFMT -o cluster_size=4k -o help "$TEST_IMG" $size +run_qemu_img create -f $IMGFMT -o cluster_size=4k -o \? "$TEST_IMG" $size + +# Looks like a help option, but is part of the backing file name +run_qemu_img create -f $IMGFMT -o backing_file="$TEST_IMG",,help "$TEST_IMG" $size +run_qemu_img create -f $IMGFMT -o backing_file="$TEST_IMG",,\? "$TEST_IMG" $size + +# Try to trick qemu-img into creating escaped commas +run_qemu_img create -f $IMGFMT -o backing_file="$TEST_IMG", -o help "$TEST_IMG" $size +run_qemu_img create -f $IMGFMT -o backing_file="$TEST_IMG" -o ,help "$TEST_IMG" $size +run_qemu_img create -f $IMGFMT -o backing_file="$TEST_IMG" -o ,, -o help "$TEST_IMG" $size + +# Leave out everything that isn't needed +run_qemu_img create -f $IMGFMT -o help +run_qemu_img create -o help + +echo +echo === convert: Options specified more than once === + +# We need a valid source image +run_qemu_img create -f $IMGFMT "$TEST_IMG" $size + +# Last -f should win +run_qemu_img convert -f foo -f $IMGFMT "$TEST_IMG" "$TEST_IMG".base +run_qemu_img info "$TEST_IMG".base + +# Last -O should win +run_qemu_img convert -O foo -O $IMGFMT "$TEST_IMG" "$TEST_IMG".base +run_qemu_img info "$TEST_IMG".base + +# Multiple -o should be merged +run_qemu_img convert -O $IMGFMT -o cluster_size=4k -o lazy_refcounts=on "$TEST_IMG" "$TEST_IMG".base +run_qemu_img info "$TEST_IMG".base + +# If the same -o key is specified more than once, the last one wins +run_qemu_img convert -O $IMGFMT -o cluster_size=4k -o lazy_refcounts=on -o cluster_size=8k "$TEST_IMG" "$TEST_IMG".base +run_qemu_img info "$TEST_IMG".base +run_qemu_img convert -O $IMGFMT -o cluster_size=4k,cluster_size=8k "$TEST_IMG" "$TEST_IMG".base +run_qemu_img info "$TEST_IMG".base + +echo +echo === convert: help for -o === + +# Adding the help option to a command without other -o options +run_qemu_img convert -O $IMGFMT -o help "$TEST_IMG" "$TEST_IMG".base +run_qemu_img convert -O $IMGFMT -o \? "$TEST_IMG" "$TEST_IMG".base + +# Adding the help option to the same -o option +run_qemu_img convert -O $IMGFMT -o cluster_size=4k,help "$TEST_IMG" "$TEST_IMG".base +run_qemu_img convert -O $IMGFMT -o cluster_size=4k,\? "$TEST_IMG" "$TEST_IMG".base +run_qemu_img convert -O $IMGFMT -o help,cluster_size=4k "$TEST_IMG" "$TEST_IMG".base +run_qemu_img convert -O $IMGFMT -o \?,cluster_size=4k "$TEST_IMG" "$TEST_IMG".base + +# Adding the help option to a separate -o option +run_qemu_img convert -O $IMGFMT -o cluster_size=4k -o help "$TEST_IMG" "$TEST_IMG".base +run_qemu_img convert -O $IMGFMT -o cluster_size=4k -o \? "$TEST_IMG" "$TEST_IMG".base + +# Looks like a help option, but is part of the backing file name +run_qemu_img convert -O $IMGFMT -o backing_file="$TEST_IMG",,help "$TEST_IMG" "$TEST_IMG".base +run_qemu_img convert -O $IMGFMT -o backing_file="$TEST_IMG",,\? "$TEST_IMG" "$TEST_IMG".base + +# Try to trick qemu-img into creating escaped commas +run_qemu_img convert -O $IMGFMT -o backing_file="$TEST_IMG", -o help "$TEST_IMG" "$TEST_IMG".base +run_qemu_img convert -O $IMGFMT -o backing_file="$TEST_IMG" -o ,help "$TEST_IMG" "$TEST_IMG".base +run_qemu_img convert -O $IMGFMT -o backing_file="$TEST_IMG" -o ,, -o help "$TEST_IMG" "$TEST_IMG".base + +# Leave out everything that isn't needed +run_qemu_img convert -O $IMGFMT -o help +run_qemu_img convert -o help + +echo +echo === amend: Options specified more than once === + +# Last -f should win +run_qemu_img amend -f foo -f $IMGFMT -o lazy_refcounts=on "$TEST_IMG" +run_qemu_img info "$TEST_IMG" + +# Multiple -o should be merged +run_qemu_img amend -f $IMGFMT -o size=130M -o lazy_refcounts=off "$TEST_IMG" +run_qemu_img info "$TEST_IMG" + +# If the same -o key is specified more than once, the last one wins +run_qemu_img amend -f $IMGFMT -o size=8M -o lazy_refcounts=on -o size=132M "$TEST_IMG" +run_qemu_img info "$TEST_IMG" +run_qemu_img amend -f $IMGFMT -o size=4M,size=148M "$TEST_IMG" +run_qemu_img info "$TEST_IMG" + +echo +echo === amend: help for -o === + +# Adding the help option to a command without other -o options +run_qemu_img amend -f $IMGFMT -o help "$TEST_IMG" +run_qemu_img amend -f $IMGFMT -o \? "$TEST_IMG" + +# Adding the help option to the same -o option +run_qemu_img amend -f $IMGFMT -o cluster_size=4k,help "$TEST_IMG" +run_qemu_img amend -f $IMGFMT -o cluster_size=4k,\? "$TEST_IMG" +run_qemu_img amend -f $IMGFMT -o help,cluster_size=4k "$TEST_IMG" +run_qemu_img amend -f $IMGFMT -o \?,cluster_size=4k "$TEST_IMG" + +# Adding the help option to a separate -o option +run_qemu_img amend -f $IMGFMT -o cluster_size=4k -o help "$TEST_IMG" +run_qemu_img amend -f $IMGFMT -o cluster_size=4k -o \? "$TEST_IMG" + +# Looks like a help option, but is part of the backing file name +run_qemu_img amend -f $IMGFMT -o backing_file="$TEST_IMG",,help "$TEST_IMG" +run_qemu_img rebase -u -b "" -f $IMGFMT "$TEST_IMG" + +run_qemu_img amend -f $IMGFMT -o backing_file="$TEST_IMG",,\? "$TEST_IMG" +run_qemu_img rebase -u -b "" -f $IMGFMT "$TEST_IMG" + +# Try to trick qemu-img into creating escaped commas +run_qemu_img amend -f $IMGFMT -o backing_file="$TEST_IMG", -o help "$TEST_IMG" +run_qemu_img amend -f $IMGFMT -o backing_file="$TEST_IMG" -o ,help "$TEST_IMG" +run_qemu_img amend -f $IMGFMT -o backing_file="$TEST_IMG" -o ,, -o help "$TEST_IMG" + +# Leave out everything that isn't needed +run_qemu_img amend -f $IMGFMT -o help +run_qemu_img convert -o help + +# success, all done +echo "*** done" +rm -f $seq.full +status=0 diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out new file mode 100644 index 0000000000..28309a0327 --- /dev/null +++ b/tests/qemu-iotests/082.out @@ -0,0 +1,529 @@ +QA output created by 082 + +=== create: Options specified more than once === + +Testing: create -f foo -f qcow2 TEST_DIR/t.qcow2 128M +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 encryption=off cluster_size=65536 lazy_refcounts=off + +Testing: info TEST_DIR/t.qcow2 +image: TEST_DIR/t.qcow2 +file format: qcow2 +virtual size: 128M (134217728 bytes) +disk size: 196K +cluster_size: 65536 +Format specific information: + compat: 1.1 + lazy refcounts: false + +Testing: create -f qcow2 -o cluster_size=4k -o lazy_refcounts=on TEST_DIR/t.qcow2 128M +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 encryption=off cluster_size=4096 lazy_refcounts=on + +Testing: info TEST_DIR/t.qcow2 +image: TEST_DIR/t.qcow2 +file format: qcow2 +virtual size: 128M (134217728 bytes) +disk size: 16K +cluster_size: 4096 +Format specific information: + compat: 1.1 + lazy refcounts: true + +Testing: create -f qcow2 -o cluster_size=4k -o lazy_refcounts=on -o cluster_size=8k TEST_DIR/t.qcow2 128M +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 encryption=off cluster_size=8192 lazy_refcounts=on + +Testing: info TEST_DIR/t.qcow2 +image: TEST_DIR/t.qcow2 +file format: qcow2 +virtual size: 128M (134217728 bytes) +disk size: 28K +cluster_size: 8192 +Format specific information: + compat: 1.1 + lazy refcounts: true + +Testing: create -f qcow2 -o cluster_size=4k,cluster_size=8k TEST_DIR/t.qcow2 128M +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 encryption=off cluster_size=8192 lazy_refcounts=off + +Testing: info TEST_DIR/t.qcow2 +image: TEST_DIR/t.qcow2 +file format: qcow2 +virtual size: 128M (134217728 bytes) +disk size: 28K +cluster_size: 8192 +Format specific information: + compat: 1.1 + lazy refcounts: false + +=== create: help for -o === + +Testing: create -f qcow2 -o help TEST_DIR/t.qcow2 128M +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: create -f qcow2 -o ? TEST_DIR/t.qcow2 128M +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: create -f qcow2 -o cluster_size=4k,help TEST_DIR/t.qcow2 128M +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: create -f qcow2 -o cluster_size=4k,? TEST_DIR/t.qcow2 128M +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: create -f qcow2 -o help,cluster_size=4k TEST_DIR/t.qcow2 128M +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: create -f qcow2 -o ?,cluster_size=4k TEST_DIR/t.qcow2 128M +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: create -f qcow2 -o cluster_size=4k -o help TEST_DIR/t.qcow2 128M +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: create -f qcow2 -o cluster_size=4k -o ? TEST_DIR/t.qcow2 128M +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: create -f qcow2 -o backing_file=TEST_DIR/t.qcow2,,help TEST_DIR/t.qcow2 128M +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 backing_file='TEST_DIR/t.qcow2,help' encryption=off cluster_size=65536 lazy_refcounts=off + +Testing: create -f qcow2 -o backing_file=TEST_DIR/t.qcow2,,? TEST_DIR/t.qcow2 128M +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 backing_file='TEST_DIR/t.qcow2,?' encryption=off cluster_size=65536 lazy_refcounts=off + +Testing: create -f qcow2 -o backing_file=TEST_DIR/t.qcow2, -o help TEST_DIR/t.qcow2 128M +qemu-img: Invalid option list: backing_file=TEST_DIR/t.qcow2, + +Testing: create -f qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,help TEST_DIR/t.qcow2 128M +qemu-img: Invalid option list: ,help + +Testing: create -f qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,, -o help TEST_DIR/t.qcow2 128M +qemu-img: Invalid option list: ,, + +Testing: create -f qcow2 -o help +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: create -o help +Supported options: +size Virtual disk size + +=== convert: Options specified more than once === + +Testing: create -f qcow2 TEST_DIR/t.qcow2 128M +Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 encryption=off cluster_size=65536 lazy_refcounts=off + +Testing: convert -f foo -f qcow2 TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base + +Testing: info TEST_DIR/t.qcow2.base +image: TEST_DIR/t.qcow2.base +file format: raw +virtual size: 128M (134217728 bytes) +disk size: 0 + +Testing: convert -O foo -O qcow2 TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base + +Testing: info TEST_DIR/t.qcow2.base +image: TEST_DIR/t.qcow2.base +file format: qcow2 +virtual size: 128M (134217728 bytes) +disk size: 196K +cluster_size: 65536 +Format specific information: + compat: 1.1 + lazy refcounts: false + +Testing: convert -O qcow2 -o cluster_size=4k -o lazy_refcounts=on TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base + +Testing: info TEST_DIR/t.qcow2.base +image: TEST_DIR/t.qcow2.base +file format: qcow2 +virtual size: 128M (134217728 bytes) +disk size: 16K +cluster_size: 4096 +Format specific information: + compat: 1.1 + lazy refcounts: true + +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 + +Testing: info TEST_DIR/t.qcow2.base +image: TEST_DIR/t.qcow2.base +file format: qcow2 +virtual size: 128M (134217728 bytes) +disk size: 28K +cluster_size: 8192 +Format specific information: + compat: 1.1 + lazy refcounts: true + +Testing: convert -O qcow2 -o cluster_size=4k,cluster_size=8k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base + +Testing: info TEST_DIR/t.qcow2.base +image: TEST_DIR/t.qcow2.base +file format: qcow2 +virtual size: 128M (134217728 bytes) +disk size: 28K +cluster_size: 8192 +Format specific information: + compat: 1.1 + lazy refcounts: false + +=== convert: help for -o === + +Testing: convert -O qcow2 -o help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: convert -O qcow2 -o ? TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: convert -O qcow2 -o cluster_size=4k,help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: convert -O qcow2 -o cluster_size=4k,? TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: convert -O qcow2 -o help,cluster_size=4k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: convert -O qcow2 -o ?,cluster_size=4k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: convert -O qcow2 -o cluster_size=4k -o help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: convert -O qcow2 -o cluster_size=4k -o ? TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: convert -O qcow2 -o backing_file=TEST_DIR/t.qcow2,,help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +qemu-img: Could not open 'TEST_DIR/t.qcow2.base': Could not open backing file: Could not open 'TEST_DIR/t.qcow2,help': No such file or directory + +Testing: convert -O qcow2 -o backing_file=TEST_DIR/t.qcow2,,? TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +qemu-img: Could not open 'TEST_DIR/t.qcow2.base': Could not open backing file: Could not open 'TEST_DIR/t.qcow2,?': No such file or directory + +Testing: convert -O qcow2 -o backing_file=TEST_DIR/t.qcow2, -o help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +qemu-img: Invalid option list: backing_file=TEST_DIR/t.qcow2, + +Testing: convert -O qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +qemu-img: Invalid option list: ,help + +Testing: convert -O qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,, -o help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +qemu-img: Invalid option list: ,, + +Testing: convert -O qcow2 -o help +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: convert -o help +Supported options: +size Virtual disk size + +=== amend: Options specified more than once === + +Testing: amend -f foo -f qcow2 -o lazy_refcounts=on TEST_DIR/t.qcow2 + +Testing: info TEST_DIR/t.qcow2 +image: TEST_DIR/t.qcow2 +file format: qcow2 +virtual size: 128M (134217728 bytes) +disk size: 196K +cluster_size: 65536 +Format specific information: + compat: 1.1 + lazy refcounts: true + +Testing: amend -f qcow2 -o size=130M -o lazy_refcounts=off TEST_DIR/t.qcow2 + +Testing: info TEST_DIR/t.qcow2 +image: TEST_DIR/t.qcow2 +file format: qcow2 +virtual size: 130M (136314880 bytes) +disk size: 196K +cluster_size: 65536 +Format specific information: + compat: 1.1 + lazy refcounts: false + +Testing: amend -f qcow2 -o size=8M -o lazy_refcounts=on -o size=132M TEST_DIR/t.qcow2 + +Testing: info TEST_DIR/t.qcow2 +image: TEST_DIR/t.qcow2 +file format: qcow2 +virtual size: 132M (138412032 bytes) +disk size: 196K +cluster_size: 65536 +Format specific information: + compat: 1.1 + lazy refcounts: true + +Testing: amend -f qcow2 -o size=4M,size=148M TEST_DIR/t.qcow2 + +Testing: info TEST_DIR/t.qcow2 +image: TEST_DIR/t.qcow2 +file format: qcow2 +virtual size: 148M (155189248 bytes) +disk size: 196K +cluster_size: 65536 +Format specific information: + compat: 1.1 + lazy refcounts: true + +=== amend: help for -o === + +Testing: amend -f qcow2 -o help TEST_DIR/t.qcow2 +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: amend -f qcow2 -o ? TEST_DIR/t.qcow2 +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: amend -f qcow2 -o cluster_size=4k,help TEST_DIR/t.qcow2 +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: amend -f qcow2 -o cluster_size=4k,? TEST_DIR/t.qcow2 +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: amend -f qcow2 -o help,cluster_size=4k TEST_DIR/t.qcow2 +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: amend -f qcow2 -o ?,cluster_size=4k TEST_DIR/t.qcow2 +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: amend -f qcow2 -o cluster_size=4k -o help TEST_DIR/t.qcow2 +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: amend -f qcow2 -o cluster_size=4k -o ? TEST_DIR/t.qcow2 +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: amend -f qcow2 -o backing_file=TEST_DIR/t.qcow2,,help TEST_DIR/t.qcow2 + +Testing: rebase -u -b -f qcow2 TEST_DIR/t.qcow2 + +Testing: amend -f qcow2 -o backing_file=TEST_DIR/t.qcow2,,? TEST_DIR/t.qcow2 + +Testing: rebase -u -b -f qcow2 TEST_DIR/t.qcow2 + +Testing: amend -f qcow2 -o backing_file=TEST_DIR/t.qcow2, -o help TEST_DIR/t.qcow2 +qemu-img: Invalid option list: backing_file=TEST_DIR/t.qcow2, + +Testing: amend -f qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,help TEST_DIR/t.qcow2 +qemu-img: Invalid option list: ,help + +Testing: amend -f qcow2 -o backing_file=TEST_DIR/t.qcow2 -o ,, -o help TEST_DIR/t.qcow2 +qemu-img: Invalid option list: ,, + +Testing: amend -f qcow2 -o help +Supported options: +size Virtual disk size +compat Compatibility level (0.10 or 1.1) +backing_file File name of a base image +backing_fmt Image format of the base image +encryption Encrypt the image +cluster_size qcow2 cluster size +preallocation Preallocation mode (allowed values: off, metadata) +lazy_refcounts Postpone refcount updates + +Testing: convert -o help +Supported options: +size Virtual disk size +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index d8be74a17e..db127d924d 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -83,3 +83,5 @@ 074 rw auto 077 rw auto 079 rw auto +081 rw auto +082 rw auto quick |