thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From f65ef16bd01c14e252e262ec24ff3ac16e0e335d Mon Sep 17 00:00:00 2001
9ae3a8
From: Max Reitz <mreitz@redhat.com>
9ae3a8
Date: Sat, 13 Jun 2015 16:21:59 +0200
9ae3a8
Subject: [PATCH 05/42] iotests: Add test for image header overlap
9ae3a8
9ae3a8
Message-id: <1434212556-3927-6-git-send-email-mreitz@redhat.com>
9ae3a8
Patchwork-id: 66024
9ae3a8
O-Subject: [RHEL-7.2 qemu-kvm PATCH 05/42] iotests: Add test for image header overlap
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
Add a test for an image with an unallocated image header; instead of an
9ae3a8
assertion, this should result in the image being marked corrupt.
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 a42f8a3d05c5598cee893c9cf5ffeee48bacb83e)
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     | 9 +++++++++
9ae3a8
 tests/qemu-iotests/060.out | 8 ++++++++
9ae3a8
 2 files changed, 17 insertions(+)
9ae3a8
9ae3a8
diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
9ae3a8
index 2abd566..5180e23 100644
9ae3a8
--- a/tests/qemu-iotests/060
9ae3a8
+++ b/tests/qemu-iotests/060
9ae3a8
@@ -164,6 +164,15 @@ wait_break 0
9ae3a8
 write 64k 64k
9ae3a8
 resume 0" | $QEMU_IO | _filter_qemu_io
9ae3a8
 
9ae3a8
+echo
9ae3a8
+echo "=== Testing unallocated image header ==="
9ae3a8
+echo
9ae3a8
+_make_test_img 64M
9ae3a8
+# Create L1/L2
9ae3a8
+$QEMU_IO -c "$OPEN_RW" -c "write 0 64k" | _filter_qemu_io
9ae3a8
+poke_file "$TEST_IMG" "$rb_offset" "\x00\x00"
9ae3a8
+$QEMU_IO -c "$OPEN_RW" -c "write 64k 64k" | _filter_qemu_io
9ae3a8
+
9ae3a8
 # success, all done
9ae3a8
 echo "*** done"
9ae3a8
 rm -f $seq.full
9ae3a8
diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out
9ae3a8
index a517948..c27c952 100644
9ae3a8
--- a/tests/qemu-iotests/060.out
9ae3a8
+++ b/tests/qemu-iotests/060.out
9ae3a8
@@ -93,4 +93,12 @@ blkdebug: Suspended request '0'
9ae3a8
 write failed: Input/output error
9ae3a8
 blkdebug: Resuming request '0'
9ae3a8
 aio_write failed: No medium found
9ae3a8
+
9ae3a8
+=== Testing unallocated image header ===
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: Preventing invalid write on metadata (overlaps with qcow2_header); image marked as corrupt.
9ae3a8
+write failed: Input/output error
9ae3a8
 *** done
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8