From: Roman Kagan <rka...@parallels.com>

This patch adds a testcase for reading from a backing file when both the
current image and the backing one are in parallels format.

Signed-off-by: Roman Kagan <rka...@parallels.com>
Signed-off-by: Denis V. Lunev <d...@openvz.org>
CC: Jeff Cody <jc...@redhat.com>
CC: Kevin Wolf <kw...@redhat.com>
CC: Stefan Hajnoczi <stefa...@redhat.com>
---
 tests/qemu-iotests/076     | 21 +++++++++++++++++++++
 tests/qemu-iotests/076.out |  4 ++++
 2 files changed, 25 insertions(+)

diff --git a/tests/qemu-iotests/076 b/tests/qemu-iotests/076
index 766b359..04b359b 100755
--- a/tests/qemu-iotests/076
+++ b/tests/qemu-iotests/076
@@ -31,6 +31,11 @@ status=1     # failure is the default!
 _cleanup()
 {
        _cleanup_test_img
+
+   if [ -n "$TEST_IMG_BASE" ]
+   then
+       rm -f "$TEST_IMG_BASE"
+   fi
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
@@ -87,6 +92,22 @@ _use_sample_img parallels-v2-padded.bz2
 _use_sample_img parallels-padded.xml.bz2
 { $QEMU_IO -c "read -P 0x11 0 64k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | 
_filter_testdir
 
+echo
+echo "== Read from an image with a backing image =="
+TEST_IMG_BASE="$TEST_IMG.base"
+_use_sample_img parallels-v1.bz2
+mv -f "$TEST_IMG" "$TEST_IMG_BASE"
+dd if="$TEST_IMG_BASE" of="$TEST_IMG" bs=64 count=1 &>/dev/null
+dd if=/dev/zero of="$TEST_IMG" bs=1M count=0 seek=1 conv=notrunc &>/dev/null
+{ $QEMU_IO -c "read -P 0x11 0 64k" \
+    "json:{
+        \"file\": {\"filename\": \"$TEST_IMG\"},
+        \"backing\":{
+            \"file\":{\"filename\":\"$TEST_IMG_BASE\"},
+            \"driver\":\"parallels\"
+        }
+    }"; } 2>&1 | _filter_qemu_io | _filter_testdir
+
 # success, all done
 echo "*** done"
 rm -f $seq.full
diff --git a/tests/qemu-iotests/076.out b/tests/qemu-iotests/076.out
index 46680d8..0cce00c 100644
--- a/tests/qemu-iotests/076.out
+++ b/tests/qemu-iotests/076.out
@@ -27,4 +27,8 @@ read 65536/65536 bytes at offset 0
 == Read from a valid v2 image opened through xml with padding ==
 read 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
+== Read from an image with a backing image ==
+read 65536/65536 bytes at offset 0
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 *** done
-- 
1.9.1


Reply via email to