Skip to content

Commit

Permalink
iotests: Add test for image header overlap
Browse files Browse the repository at this point in the history
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 <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
XanClic authored and kevmw committed Aug 15, 2014
1 parent ff52aab commit a42f8a3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/qemu-iotests/060
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions tests/qemu-iotests/060.out
Expand Up @@ -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

0 comments on commit a42f8a3

Please sign in to comment.