0a122b
From 445ea167eadbc4b951b46c8a2ab52cc0ce681aac Mon Sep 17 00:00:00 2001
0a122b
From: Jeffrey Cody <jcody@redhat.com>
0a122b
Date: Wed, 20 Nov 2013 19:44:07 +0100
0a122b
Subject: [PATCH 24/25] block: qemu-iotests for vhdx, add write test support
0a122b
0a122b
RH-Author: Jeffrey Cody <jcody@redhat.com>
0a122b
Message-id: <dfa3072f5edd6daf7e2088b868ababb5ff8afe06.1384975172.git.jcody@redhat.com>
0a122b
Patchwork-id: 55817
0a122b
O-Subject: [RHEL7 qemu-kvm PATCH 24/26] block: qemu-iotests for vhdx, add write test support
0a122b
Bugzilla: 879234
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
RH-Acked-by: Fam Zheng <famz@redhat.com>
0a122b
0a122b
This removes the IMGFMT_GENERIC blocker for read-only, so existing
0a122b
iotests run read/write tests for vhdx images created by qemu-img (e.g.
0a122b
tests 001, 002, 003).
0a122b
0a122b
In addition, this updates the sample image test for the Hyper-V
0a122b
created image, to verify we can write it as well.
0a122b
0a122b
Signed-off-by: Jeff Cody <jcody@redhat.com>
0a122b
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
(cherry picked from commit 751aec24cdcd4359b5927df5cebfe6b8d3e74515)
0a122b
0a122b
RHEL7 Note:  Difference from upstream - there was a typo in this patch,
0a122b
             that used 'MM' instead of 'M' for size passed into qemu-io.
0a122b
             Upstream apparently gobbles the extra 'M' without error,
0a122b
             but RHEL7 does not.  Fix this so that test 064 passes.
0a122b
0a122b
Signed-off-by: Jeff Cody <jcody@redhat.com>
0a122b
---
0a122b
 tests/qemu-iotests/064     | 11 +++++++++++
0a122b
 tests/qemu-iotests/064.out | 14 ++++++++++++++
0a122b
 tests/qemu-iotests/common  |  1 -
0a122b
 3 files changed, 25 insertions(+), 1 deletion(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 tests/qemu-iotests/064     |   11 +++++++++++
0a122b
 tests/qemu-iotests/064.out |   14 ++++++++++++++
0a122b
 tests/qemu-iotests/common  |    1 -
0a122b
 3 files changed, 25 insertions(+), 1 deletions(-)
0a122b
0a122b
diff --git a/tests/qemu-iotests/064 b/tests/qemu-iotests/064
0a122b
index 6789aa6..906205e 100755
0a122b
--- a/tests/qemu-iotests/064
0a122b
+++ b/tests/qemu-iotests/064
0a122b
@@ -56,6 +56,17 @@ echo
0a122b
 echo "=== Verify pattern 0x00, 66M - 1024M ==="
0a122b
 $QEMU_IO -r -c "read -pP 0x00 66M 958M" "$TEST_IMG" | _filter_qemu_io
0a122b
 
0a122b
+echo
0a122b
+echo "=== Verify pattern write, 0xc3 99M-157M ==="
0a122b
+$QEMU_IO -c "write -pP 0xc3 99M 58M" "$TEST_IMG" | _filter_qemu_io
0a122b
+# first verify we didn't write where we should not have
0a122b
+$QEMU_IO -c "read -pP 0xa5 0 33M" "$TEST_IMG" | _filter_qemu_io
0a122b
+$QEMU_IO -c "read -pP 0x96 33M 33M" "$TEST_IMG" | _filter_qemu_io
0a122b
+$QEMU_IO -c "read -pP 0x00 66M 33M" "$TEST_IMG" | _filter_qemu_io
0a122b
+$QEMU_IO -c "read -pP 0x00 157M 867M" "$TEST_IMG" | _filter_qemu_io
0a122b
+# now verify what we should have actually written
0a122b
+$QEMU_IO -c "read -pP 0xc3 99M 58M" "$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/064.out b/tests/qemu-iotests/064.out
0a122b
index b9e8e4a..5346a4e 100644
0a122b
--- a/tests/qemu-iotests/064.out
0a122b
+++ b/tests/qemu-iotests/064.out
0a122b
@@ -11,4 +11,18 @@ read 34603008/34603008 bytes at offset 34603008
0a122b
 === Verify pattern 0x00, 66M - 1024M ===
0a122b
 read 1004535808/1004535808 bytes at offset 69206016
0a122b
 958 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+
0a122b
+=== Verify pattern write, 0xc3 99M-157M ===
0a122b
+wrote 60817408/60817408 bytes at offset 103809024
0a122b
+58 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+read 34603008/34603008 bytes at offset 0
0a122b
+33 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+read 34603008/34603008 bytes at offset 34603008
0a122b
+33 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+read 34603008/34603008 bytes at offset 69206016
0a122b
+33 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+read 909115392/909115392 bytes at offset 164626432
0a122b
+867 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+read 60817408/60817408 bytes at offset 103809024
0a122b
+58 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
 *** done
0a122b
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
0a122b
index 2932e14..8cde7f1 100644
0a122b
--- a/tests/qemu-iotests/common
0a122b
+++ b/tests/qemu-iotests/common
0a122b
@@ -200,7 +200,6 @@ testlist options
0a122b
         -vhdx)
0a122b
             IMGFMT=vhdx
0a122b
             xpand=false
0a122b
-            IMGFMT_GENERIC=false
0a122b
             ;;
0a122b
 
0a122b
         -rbd)
0a122b
-- 
0a122b
1.7.1
0a122b