0a122b
From af156d9a912c96203f26cde732f95357d7f63cd4 Mon Sep 17 00:00:00 2001
0a122b
From: Max Reitz <mreitz@redhat.com>
0a122b
Date: Tue, 7 Jan 2014 21:57:18 +0100
0a122b
Subject: [PATCH 13/14] qemu-iotests: New test case in 061
0a122b
0a122b
RH-Author: Max Reitz <mreitz@redhat.com>
0a122b
Message-id: <1389131839-12920-14-git-send-email-mreitz@redhat.com>
0a122b
Patchwork-id: 56549
0a122b
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 13/14] qemu-iotests: New test case in 061
0a122b
Bugzilla: 1033490
0a122b
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
0a122b
RH-Acked-by: Fam Zheng <famz@redhat.com>
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
0a122b
BZ: 1033490
0a122b
0a122b
Add one test case for zero cluster expansion on qcow2 version downgrade
0a122b
in shared L2 tables (i.e., L2 tables with a refcount > 1) and one for
0a122b
zero expansion on backed clusters in shared L2 tables.
0a122b
0a122b
Signed-off-by: Max Reitz <mreitz@redhat.com>
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
(cherry picked from commit d982919d3897f36d79e215c46e3bc27fd6e27bf8)
0a122b
0a122b
Signed-off-by: Max Reitz <mreitz@redhat.com>
0a122b
---
0a122b
 tests/qemu-iotests/061     | 28 ++++++++++++++++++++++++++++
0a122b
 tests/qemu-iotests/061.out | 27 +++++++++++++++++++++++++++
0a122b
 2 files changed, 55 insertions(+)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 tests/qemu-iotests/061     |   28 ++++++++++++++++++++++++++++
0a122b
 tests/qemu-iotests/061.out |   27 +++++++++++++++++++++++++++
0a122b
 2 files changed, 55 insertions(+), 0 deletions(-)
0a122b
0a122b
diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061
0a122b
index 86404e6..5f04bfa 100644
0a122b
--- a/tests/qemu-iotests/061
0a122b
+++ b/tests/qemu-iotests/061
0a122b
@@ -146,6 +146,19 @@ _check_test_img
0a122b
 $QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
0a122b
 
0a122b
 echo
0a122b
+echo "=== Testing zero expansion on shared L2 table ==="
0a122b
+echo
0a122b
+IMGOPTS="compat=1.1" _make_test_img 64M
0a122b
+$QEMU_IO -c "write -z 0 128k" "$TEST_IMG" | _filter_qemu_io
0a122b
+$QEMU_IMG snapshot -c foo "$TEST_IMG"
0a122b
+$QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
0a122b
+_check_test_img
0a122b
+$QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
0a122b
+$QEMU_IMG snapshot -a foo "$TEST_IMG"
0a122b
+_check_test_img
0a122b
+$QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
0a122b
+
0a122b
+echo
0a122b
 echo "=== Testing zero expansion on backed image ==="
0a122b
 echo
0a122b
 IMGOPTS="compat=1.1" TEST_IMG="$TEST_IMG.base" _make_test_img 64M
0a122b
@@ -172,6 +185,21 @@ $QEMU_IMG snapshot -a foo "$TEST_IMG"
0a122b
 _check_test_img
0a122b
 $QEMU_IO -c "read -P 0 0 64k" -c "read -P 0x2a 64k 64k" "$TEST_IMG" | _filter_qemu_io
0a122b
 
0a122b
+echo
0a122b
+echo "=== Testing zero expansion on backed image with shared L2 table ==="
0a122b
+echo
0a122b
+IMGOPTS="compat=1.1" TEST_IMG="$TEST_IMG.base" _make_test_img 64M
0a122b
+$QEMU_IO -c "write -P 0x2a 0 128k" "$TEST_IMG.base" | _filter_qemu_io
0a122b
+IMGOPTS="compat=1.1,backing_file=$TEST_IMG.base" _make_test_img 64M
0a122b
+$QEMU_IO -c "write -z 0 128k" "$TEST_IMG" | _filter_qemu_io
0a122b
+$QEMU_IMG snapshot -c foo "$TEST_IMG"
0a122b
+$QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
0a122b
+_check_test_img
0a122b
+$QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
0a122b
+$QEMU_IMG snapshot -a foo "$TEST_IMG"
0a122b
+_check_test_img
0a122b
+$QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
0a122b
+
0a122b
 # success, all done
0a122b
 echo "*** done"
0a122b
 rm -f $seq.full
0a122b
diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out
0a122b
index 05bd1d5..d42127f 100644
0a122b
--- a/tests/qemu-iotests/061.out
0a122b
+++ b/tests/qemu-iotests/061.out
0a122b
@@ -312,6 +312,18 @@ No errors were found on the image.
0a122b
 read 131072/131072 bytes at offset 0
0a122b
 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
 
0a122b
+=== Testing zero expansion on shared L2 table ===
0a122b
+
0a122b
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 
0a122b
+wrote 131072/131072 bytes at offset 0
0a122b
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+No errors were found on the image.
0a122b
+read 131072/131072 bytes at offset 0
0a122b
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+No errors were found on the image.
0a122b
+read 131072/131072 bytes at offset 0
0a122b
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+
0a122b
 === Testing zero expansion on backed image ===
0a122b
 
0a122b
 Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864 
0a122b
@@ -346,4 +358,19 @@ read 65536/65536 bytes at offset 0
0a122b
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
 read 65536/65536 bytes at offset 65536
0a122b
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+
0a122b
+=== Testing zero expansion on backed image with shared L2 table ===
0a122b
+
0a122b
+Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864 
0a122b
+wrote 131072/131072 bytes at offset 0
0a122b
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file='TEST_DIR/t.IMGFMT.base' 
0a122b
+wrote 131072/131072 bytes at offset 0
0a122b
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+No errors were found on the image.
0a122b
+read 131072/131072 bytes at offset 0
0a122b
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+No errors were found on the image.
0a122b
+read 131072/131072 bytes at offset 0
0a122b
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
 *** done
0a122b
-- 
0a122b
1.7.1
0a122b