aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2019-07-24 19:12:38 +0200
committerMax Reitz <mreitz@redhat.com>2019-08-19 17:13:26 +0200
commitc2acc95befc2e03d8395dead80024a49819b4a23 (patch)
tree8ce1faa0ba1a3aebbb1b34206474336186f11eac /tests
parent5a840549ee68a6c2bbcee4c402793375646bdc92 (diff)
downloadqemu-c2acc95befc2e03d8395dead80024a49819b4a23.zip
qemu-c2acc95befc2e03d8395dead80024a49819b4a23.tar.gz
qemu-c2acc95befc2e03d8395dead80024a49819b4a23.tar.bz2
iotests: Test convert -n to pre-filled image
Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 20190724171239.8764-11-mreitz@redhat.com Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/qemu-iotests/12217
-rw-r--r--tests/qemu-iotests/122.out8
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/qemu-iotests/122 b/tests/qemu-iotests/122
index 85c3a8d..059011e 100755
--- a/tests/qemu-iotests/122
+++ b/tests/qemu-iotests/122
@@ -257,6 +257,23 @@ for min_sparse in 4k 8k; do
$QEMU_IMG map --output=json "$TEST_IMG".orig | _filter_qemu_img_map
done
+
+echo
+echo '=== -n to a non-zero image ==='
+echo
+
+# Keep source zero
+_make_test_img 64M
+
+# Output is not zero, but has bdrv_has_zero_init() == 1
+TEST_IMG="$TEST_IMG".orig _make_test_img 64M
+$QEMU_IO -c "write -P 42 0 64k" "$TEST_IMG".orig | _filter_qemu_io
+
+# Convert with -n, which should not assume that the target is zeroed
+$QEMU_IMG convert -O $IMGFMT -n "$TEST_IMG" "$TEST_IMG".orig
+
+$QEMU_IMG compare "$TEST_IMG" "$TEST_IMG".orig
+
# success, all done
echo '*** done'
rm -f $seq.full
diff --git a/tests/qemu-iotests/122.out b/tests/qemu-iotests/122.out
index c576705..849b6cc 100644
--- a/tests/qemu-iotests/122.out
+++ b/tests/qemu-iotests/122.out
@@ -220,4 +220,12 @@ convert -c -S 8k
{ "start": 9216, "length": 8192, "depth": 0, "zero": true, "data": false},
{ "start": 17408, "length": 1024, "depth": 0, "zero": false, "data": true},
{ "start": 18432, "length": 67090432, "depth": 0, "zero": true, "data": false}]
+
+=== -n to a non-zero image ===
+
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
+Formatting 'TEST_DIR/t.IMGFMT.orig', fmt=IMGFMT size=67108864
+wrote 65536/65536 bytes at offset 0
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+Images are identical.
*** done