Patchwork qemu-iotests: Improve rebase test

login
register
mail settings
Submitter Kevin Wolf
Date April 29, 2010, 12:47 p.m.
Message ID <1272545237-11921-1-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/51289/
State New
Headers show

Comments

Kevin Wolf - April 29, 2010, 12:47 p.m.
The old test didn't consider cases in which the COW files contains some
unallocated clusters and after them allocated ones again.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 024     |   24 ++++++++++++++++++++++--
 024.out |   63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+), 2 deletions(-)
Christoph Hellwig - May 4, 2010, 5:02 p.m.
On Thu, Apr 29, 2010 at 02:47:17PM +0200, Kevin Wolf wrote:
> The old test didn't consider cases in which the COW files contains some
> unallocated clusters and after them allocated ones again.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>

Thanks, applied.

Patch

diff --git a/024 b/024
index 2b2ebf1..48680ca 100755
--- a/024
+++ b/024
@@ -52,19 +52,22 @@  CLUSTER_SIZE=65536
 # Backing (old) 11  --  11  --  11  --  11  --
 # Backing (new) 22  22  --  --  22  22  --  --
 # COW image     33  33  33  33  --  --  --  --
+#
+# The pattern is written twice to have both an alloc -> non-alloc and a
+# non-alloc -> alloc transition in the COW image.
 
 echo "Creating backing file"
 echo
 
 _make_test_img 1G
-io_pattern writev $((-2 * CLUSTER_SIZE)) $CLUSTER_SIZE $((2 * CLUSTER_SIZE)) 4 0x11
+io_pattern writev $((-2 * CLUSTER_SIZE)) $CLUSTER_SIZE $((2 * CLUSTER_SIZE)) 8 0x11
 mv $TEST_IMG $TEST_IMG.base_old
 
 echo "Creating new backing file"
 echo
 
 _make_test_img 1G
-io_pattern writev $((-4 * CLUSTER_SIZE)) $((2 * CLUSTER_SIZE)) $((4 * CLUSTER_SIZE)) 2 0x22
+io_pattern writev $((-4 * CLUSTER_SIZE)) $((2 * CLUSTER_SIZE)) $((4 * CLUSTER_SIZE)) 4 0x22
 mv $TEST_IMG $TEST_IMG.base_new
 
 echo "Creating COW image"
@@ -72,6 +75,7 @@  echo
 
 _make_test_img -b $TEST_IMG.base_old 1G
 io_pattern writev 0 $((4 * CLUSTER_SIZE)) 0 1 0x33
+io_pattern writev $((8 * CLUSTER_SIZE)) $((4 * CLUSTER_SIZE)) 0 1 0x33
 
 echo "Read before the rebase to make sure everything is set up correctly"
 echo
@@ -83,6 +87,14 @@  io_pattern readv $((4 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
 io_pattern readv $((5 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
 io_pattern readv $((6 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
 io_pattern readv $((7 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
+io_pattern readv $((8 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
+io_pattern readv $((9 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
+io_pattern readv $((10 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
+io_pattern readv $((11 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
+io_pattern readv $((12 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
+io_pattern readv $((13 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
+io_pattern readv $((14 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
+io_pattern readv $((15 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
 
 echo
 echo Rebase and test again
@@ -96,6 +108,14 @@  io_pattern readv $((4 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
 io_pattern readv $((5 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
 io_pattern readv $((6 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
 io_pattern readv $((7 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
+io_pattern readv $((8 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
+io_pattern readv $((9 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
+io_pattern readv $((10 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
+io_pattern readv $((11 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
+io_pattern readv $((12 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
+io_pattern readv $((13 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
+io_pattern readv $((14 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
+io_pattern readv $((15 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
 
 
 # success, all done
diff --git a/024.out b/024.out
index f75b75e..4cee216 100644
--- a/024.out
+++ b/024.out
@@ -11,6 +11,14 @@  qemu-io> wrote 65536/65536 bytes at offset 262144
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 qemu-io> wrote 65536/65536 bytes at offset 393216
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> wrote 65536/65536 bytes at offset 524288
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> wrote 65536/65536 bytes at offset 655360
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> wrote 65536/65536 bytes at offset 786432
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> wrote 65536/65536 bytes at offset 917504
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 qemu-io> Creating new backing file
 
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=65536 
@@ -19,12 +27,19 @@  qemu-io> wrote 131072/131072 bytes at offset 0
 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 qemu-io> wrote 131072/131072 bytes at offset 262144
 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> wrote 131072/131072 bytes at offset 524288
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> wrote 131072/131072 bytes at offset 786432
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 qemu-io> Creating COW image
 
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 backing_file='TEST_DIR/t.IMGFMT.base_old' cluster_size=65536 
 === IO: pattern 0x33
 qemu-io> wrote 262144/262144 bytes at offset 0
 256 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> === IO: pattern 0x33
+qemu-io> wrote 262144/262144 bytes at offset 524288
+256 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 qemu-io> Read before the rebase to make sure everything is set up correctly
 
 === IO: pattern 0x33
@@ -51,6 +66,30 @@  qemu-io> read 65536/65536 bytes at offset 393216
 qemu-io> === IO: pattern 0x00
 qemu-io> read 65536/65536 bytes at offset 458752
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> === IO: pattern 0x33
+qemu-io> read 65536/65536 bytes at offset 524288
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> === IO: pattern 0x33
+qemu-io> read 65536/65536 bytes at offset 589824
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> === IO: pattern 0x33
+qemu-io> read 65536/65536 bytes at offset 655360
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> === IO: pattern 0x33
+qemu-io> read 65536/65536 bytes at offset 720896
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> === IO: pattern 0x11
+qemu-io> read 65536/65536 bytes at offset 786432
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> === IO: pattern 0x00
+qemu-io> read 65536/65536 bytes at offset 851968
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> === IO: pattern 0x11
+qemu-io> read 65536/65536 bytes at offset 917504
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> === IO: pattern 0x00
+qemu-io> read 65536/65536 bytes at offset 983040
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 qemu-io> 
 Rebase and test again
 
@@ -78,4 +117,28 @@  qemu-io> read 65536/65536 bytes at offset 393216
 qemu-io> === IO: pattern 0x00
 qemu-io> read 65536/65536 bytes at offset 458752
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> === IO: pattern 0x33
+qemu-io> read 65536/65536 bytes at offset 524288
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> === IO: pattern 0x33
+qemu-io> read 65536/65536 bytes at offset 589824
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> === IO: pattern 0x33
+qemu-io> read 65536/65536 bytes at offset 655360
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> === IO: pattern 0x33
+qemu-io> read 65536/65536 bytes at offset 720896
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> === IO: pattern 0x11
+qemu-io> read 65536/65536 bytes at offset 786432
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> === IO: pattern 0x00
+qemu-io> read 65536/65536 bytes at offset 851968
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> === IO: pattern 0x11
+qemu-io> read 65536/65536 bytes at offset 917504
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io> === IO: pattern 0x00
+qemu-io> read 65536/65536 bytes at offset 983040
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 qemu-io> *** done