From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFUbb-0005cb-Au for qemu-devel@nongnu.org; Thu, 07 Aug 2014 16:48:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XFUbV-0006MT-5C for qemu-devel@nongnu.org; Thu, 07 Aug 2014 16:48:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35523) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFUbU-0006MO-TN for qemu-devel@nongnu.org; Thu, 07 Aug 2014 16:48:05 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s77Km3FA019421 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 7 Aug 2014 16:48:04 -0400 From: Max Reitz Date: Thu, 7 Aug 2014 22:47:54 +0200 Message-Id: <1407444475-19516-3-git-send-email-mreitz@redhat.com> In-Reply-To: <1407444475-19516-1-git-send-email-mreitz@redhat.com> References: <1407444475-19516-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH 2/3] iotests: Add test for image header overlap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , Max Reitz Add a test for an image with an unallocated image header; instead of an assertion, this should result in the image being marked corrupt. Signed-off-by: Max Reitz --- tests/qemu-iotests/060 | 9 +++++++++ tests/qemu-iotests/060.out | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060 index 3cffc12..830386f 100755 --- a/tests/qemu-iotests/060 +++ b/tests/qemu-iotests/060 @@ -164,6 +164,15 @@ wait_break 0 write 64k 64k resume 0" | $QEMU_IO | _filter_qemu_io +echo +echo "=== Testing unallocated image header ===" +echo +_make_test_img 64M +# Create L1/L2 +$QEMU_IO -c "$OPEN_RW" -c "write 0 64k" | _filter_qemu_io +poke_file "$TEST_IMG" "$rb_offset" "\x00\x00" +$QEMU_IO -c "$OPEN_RW" -c "write 64k 64k" | _filter_qemu_io + # success, all done echo "*** done" rm -f $seq.full diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out index a517948..c27c952 100644 --- a/tests/qemu-iotests/060.out +++ b/tests/qemu-iotests/060.out @@ -93,4 +93,12 @@ blkdebug: Suspended request '0' write failed: Input/output error blkdebug: Resuming request '0' aio_write failed: No medium found + +=== Testing unallocated image header === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 +wrote 65536/65536 bytes at offset 0 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qcow2: Preventing invalid write on metadata (overlaps with qcow2_header); image marked as corrupt. +write failed: Input/output error *** done -- 2.0.3