9ae3a8
From 39256a95ce8205edc697a21b0478047908cb440b Mon Sep 17 00:00:00 2001
9ae3a8
From: Max Reitz <mreitz@redhat.com>
9ae3a8
Date: Sat, 13 Jun 2015 16:22:32 +0200
9ae3a8
Subject: [PATCH 38/42] iotests: Add tests for more corruption cases
9ae3a8
9ae3a8
Message-id: <1434212556-3927-39-git-send-email-mreitz@redhat.com>
9ae3a8
Patchwork-id: 66057
9ae3a8
O-Subject: [RHEL-7.2 qemu-kvm PATCH 38/42] iotests: Add tests for more corruption cases
9ae3a8
Bugzilla: 1129893
9ae3a8
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
9ae3a8
BZ: 1129893
9ae3a8
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
Reviewed-by: Eric Blake <eblake@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit f30136b35a271109b89353b9a5349cf32e6aeda7)
9ae3a8
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 tests/qemu-iotests/060     | 15 +++++++++++++++
9ae3a8
 tests/qemu-iotests/060.out | 13 +++++++++++++
9ae3a8
 2 files changed, 28 insertions(+)
9ae3a8
9ae3a8
diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
9ae3a8
index e1187a3..ab44c83 100644
9ae3a8
--- a/tests/qemu-iotests/060
9ae3a8
+++ b/tests/qemu-iotests/060
9ae3a8
@@ -183,6 +183,12 @@ $QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
9ae3a8
 poke_file "$TEST_IMG" "$l1_offset" "\x80\x00\x00\x00\x00\x04\x2a\x00"
9ae3a8
 $QEMU_IO -c "read 0 64k" "$TEST_IMG" | _filter_qemu_io
9ae3a8
 
9ae3a8
+# Test how well zero cluster expansion can cope with this
9ae3a8
+_make_test_img 64M
9ae3a8
+$QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
9ae3a8
+poke_file "$TEST_IMG" "$l1_offset" "\x80\x00\x00\x00\x00\x04\x2a\x00"
9ae3a8
+$QEMU_IMG amend -o compat=0.10 "$TEST_IMG"
9ae3a8
+
9ae3a8
 echo
9ae3a8
 echo "=== Testing unaligned L2 entry ==="
9ae3a8
 echo
9ae3a8
@@ -192,6 +198,15 @@ poke_file "$TEST_IMG" "$l2_offset" "\x80\x00\x00\x00\x00\x05\x2a\x00"
9ae3a8
 $QEMU_IO -c "read 0 64k" "$TEST_IMG" | _filter_qemu_io
9ae3a8
 
9ae3a8
 echo
9ae3a8
+echo "=== Testing unaligned pre-allocated zero cluster ==="
9ae3a8
+echo
9ae3a8
+_make_test_img 64M
9ae3a8
+$QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
9ae3a8
+poke_file "$TEST_IMG" "$l2_offset" "\x80\x00\x00\x00\x00\x05\x2a\x01"
9ae3a8
+# zero cluster expansion
9ae3a8
+$QEMU_IMG amend -o compat=0.10 "$TEST_IMG"
9ae3a8
+
9ae3a8
+echo
9ae3a8
 echo "=== Testing unaligned reftable entry ==="
9ae3a8
 echo
9ae3a8
 _make_test_img 64M
9ae3a8
diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out
9ae3a8
index 88332e4..def7447 100644
9ae3a8
--- a/tests/qemu-iotests/060.out
9ae3a8
+++ b/tests/qemu-iotests/060.out
9ae3a8
@@ -115,6 +115,11 @@ wrote 65536/65536 bytes at offset 0
9ae3a8
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
9ae3a8
 qcow2: Marking image as corrupt: L2 table offset 0x42a00 unaligned (L1 index: 0); further corruption events will be suppressed
9ae3a8
 read failed: Input/output error
9ae3a8
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
9ae3a8
+wrote 65536/65536 bytes at offset 0
9ae3a8
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
9ae3a8
+qcow2: Marking image as corrupt: L2 table offset 0x42a00 unaligned (L1 index: 0); further corruption events will be suppressed
9ae3a8
+qemu-img: Error while amending options: Input/output error
9ae3a8
 
9ae3a8
 === Testing unaligned L2 entry ===
9ae3a8
 
9ae3a8
@@ -124,6 +129,14 @@ wrote 65536/65536 bytes at offset 0
9ae3a8
 qcow2: Marking image as corrupt: Data cluster offset 0x52a00 unaligned (L2 offset: 0x40000, L2 index: 0); further corruption events will be suppressed
9ae3a8
 read failed: Input/output error
9ae3a8
 
9ae3a8
+=== Testing unaligned pre-allocated zero cluster ===
9ae3a8
+
9ae3a8
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
9ae3a8
+wrote 65536/65536 bytes at offset 0
9ae3a8
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
9ae3a8
+qcow2: Marking image as corrupt: Data cluster offset 0x52a00 unaligned (L2 offset: 0x40000, L2 index: 0); further corruption events will be suppressed
9ae3a8
+qemu-img: Error while amending options: Input/output error
9ae3a8
+
9ae3a8
 === Testing unaligned reftable entry ===
9ae3a8
 
9ae3a8
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8