qemu-iotests: Use qemu-io -f $IMGFMT
This patch changes $QEMU_IO so that all tests by default pass a format argument to qemu-io. There are a few cases where -f $IMGFMT is not wanted because it selects the wrong driver or json: filenames including a driver are used. They are changed to use $QEMU_IO_PROG, which doesn't include any options. Tests 071 and 081 have output changes because now the actual request fails instead of reading the 2k probing buffer. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-id: 1416497234-29880-3-git-send-email-kwolf@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
be6273da9e
commit
8f9e835fd2
@ -43,25 +43,28 @@ _supported_proto file sheepdog nfs
|
||||
_supported_os Linux
|
||||
|
||||
|
||||
# No -f, use probing for the protocol driver
|
||||
QEMU_IO_PROTO="$QEMU_IO_PROG -g --cache $CACHEMODE"
|
||||
|
||||
size=128M
|
||||
_make_test_img $size
|
||||
|
||||
echo
|
||||
echo "== reading at EOF =="
|
||||
$QEMU_IO -g -c "read -P 0 $size 512" "$TEST_IMG" | _filter_qemu_io
|
||||
$QEMU_IO_PROTO -c "read -P 0 $size 512" "$TEST_IMG" | _filter_qemu_io
|
||||
|
||||
echo
|
||||
echo "== reading far past EOF =="
|
||||
$QEMU_IO -g -c "read -P 0 256M 512" "$TEST_IMG" | _filter_qemu_io
|
||||
$QEMU_IO_PROTO -c "read -P 0 256M 512" "$TEST_IMG" | _filter_qemu_io
|
||||
|
||||
echo
|
||||
echo "== writing at EOF =="
|
||||
$QEMU_IO -g -c "write -P 66 $size 512" "$TEST_IMG" | _filter_qemu_io
|
||||
$QEMU_IO_PROTO -c "write -P 66 $size 512" "$TEST_IMG" | _filter_qemu_io
|
||||
$QEMU_IO -c "read -P 66 $size 512" "$TEST_IMG" | _filter_qemu_io
|
||||
|
||||
echo
|
||||
echo "== writing far past EOF =="
|
||||
$QEMU_IO -g -c "write -P 66 256M 512" "$TEST_IMG" | _filter_qemu_io
|
||||
$QEMU_IO_PROTO -c "write -P 66 256M 512" "$TEST_IMG" | _filter_qemu_io
|
||||
$QEMU_IO -c "read -P 66 256M 512" "$TEST_IMG" | _filter_qemu_io
|
||||
|
||||
# success, all done
|
||||
|
@ -64,7 +64,7 @@ _compare
|
||||
_compare -q
|
||||
|
||||
# Compare images with different size
|
||||
$QEMU_IMG resize "$TEST_IMG" +512M
|
||||
$QEMU_IMG resize -f $IMGFMT "$TEST_IMG" +512M
|
||||
_compare
|
||||
_compare -s
|
||||
|
||||
|
@ -89,6 +89,9 @@ _supported_fmt qcow2
|
||||
_supported_proto file
|
||||
_require_command QEMU_NBD
|
||||
|
||||
# Use -f raw instead of -f $IMGFMT for the NBD connection
|
||||
QEMU_IO_NBD="$QEMU_IO -f raw --cache=$CACHEMODE"
|
||||
|
||||
echo
|
||||
echo "== preparing image =="
|
||||
_make_test_img 64M
|
||||
@ -108,15 +111,15 @@ _export_nbd_snapshot sn1
|
||||
|
||||
echo
|
||||
echo "== verifying the exported snapshot with patterns, method 1 =="
|
||||
$QEMU_IO -c 'read -P 0xa 0x1000 0x1000' "$nbd_snapshot_img" | _filter_qemu_io
|
||||
$QEMU_IO -c 'read -P 0xb 0x2000 0x1000' "$nbd_snapshot_img" | _filter_qemu_io
|
||||
$QEMU_IO_NBD -c 'read -P 0xa 0x1000 0x1000' "$nbd_snapshot_img" | _filter_qemu_io
|
||||
$QEMU_IO_NBD -c 'read -P 0xb 0x2000 0x1000' "$nbd_snapshot_img" | _filter_qemu_io
|
||||
|
||||
_export_nbd_snapshot1 sn1
|
||||
|
||||
echo
|
||||
echo "== verifying the exported snapshot with patterns, method 2 =="
|
||||
$QEMU_IO -c 'read -P 0xa 0x1000 0x1000' "$nbd_snapshot_img" | _filter_qemu_io
|
||||
$QEMU_IO -c 'read -P 0xb 0x2000 0x1000' "$nbd_snapshot_img" | _filter_qemu_io
|
||||
$QEMU_IO_NBD -c 'read -P 0xa 0x1000 0x1000' "$nbd_snapshot_img" | _filter_qemu_io
|
||||
$QEMU_IO_NBD -c 'read -P 0xb 0x2000 0x1000' "$nbd_snapshot_img" | _filter_qemu_io
|
||||
|
||||
$QEMU_IMG convert "$TEST_IMG" -l sn1 -O qcow2 "$converted_image"
|
||||
|
||||
|
@ -63,12 +63,12 @@ echo
|
||||
TEST_IMG="$TEST_IMG.base" IMGOPTS="" IMGFMT="raw" _make_test_img $IMG_SIZE |\
|
||||
_filter_imgfmt
|
||||
_make_test_img $IMG_SIZE
|
||||
$QEMU_IO -c "open -o file.driver=blkverify,file.raw.filename=$TEST_IMG.base $TEST_IMG" \
|
||||
$QEMU_IO -c "open -o driver=raw,file.driver=blkverify,file.raw.filename=$TEST_IMG.base $TEST_IMG" \
|
||||
-c 'read 0 512' -c 'write -P 42 0x38000 512' -c 'read -P 42 0x38000 512' | _filter_qemu_io
|
||||
|
||||
$QEMU_IO -c 'write -P 42 0 512' "$TEST_IMG" | _filter_qemu_io
|
||||
|
||||
$QEMU_IO -c "open -o file.driver=blkverify,file.raw.filename=$TEST_IMG.base $TEST_IMG" \
|
||||
$QEMU_IO -c "open -o driver=raw,file.driver=blkverify,file.raw.filename=$TEST_IMG.base $TEST_IMG" \
|
||||
-c 'read -P 42 0 512' | _filter_qemu_io
|
||||
|
||||
echo
|
||||
@ -78,12 +78,12 @@ echo
|
||||
TEST_IMG="$TEST_IMG.base" IMGOPTS="" IMGFMT="raw" _make_test_img $IMG_SIZE |\
|
||||
_filter_imgfmt
|
||||
_make_test_img $IMG_SIZE
|
||||
$QEMU_IO -c "open -o file.driver=blkverify,file.raw.filename=$TEST_IMG.base,file.test.driver=$IMGFMT,file.test.file.filename=$TEST_IMG" \
|
||||
$QEMU_IO -c "open -o driver=raw,file.driver=blkverify,file.raw.filename=$TEST_IMG.base,file.test.driver=$IMGFMT,file.test.file.filename=$TEST_IMG" \
|
||||
-c 'read 0 512' -c 'write -P 42 0x38000 512' -c 'read -P 42 0x38000 512' | _filter_qemu_io
|
||||
|
||||
$QEMU_IO -c 'write -P 42 0 512' "$TEST_IMG" | _filter_qemu_io
|
||||
|
||||
$QEMU_IO -c "open -o file.driver=blkverify,file.raw.filename=$TEST_IMG.base $TEST_IMG" \
|
||||
$QEMU_IO -c "open -o driver=raw,file.driver=blkverify,file.raw.filename=$TEST_IMG.base $TEST_IMG" \
|
||||
-c 'read -P 42 0 512' | _filter_qemu_io
|
||||
|
||||
echo
|
||||
@ -163,7 +163,7 @@ echo
|
||||
echo "=== Testing blkverify on existing raw block device ==="
|
||||
echo
|
||||
|
||||
run_qemu -drive "file=$TEST_IMG.base,if=none,id=drive0" <<EOF
|
||||
run_qemu -drive "file=$TEST_IMG.base,format=raw,if=none,id=drive0" <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "blockdev-add",
|
||||
"arguments": {
|
||||
|
@ -12,7 +12,7 @@ read 512/512 bytes at offset 229376
|
||||
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
wrote 512/512 bytes at offset 0
|
||||
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
blkverify: read sector_num=0 nb_sectors=4 contents mismatch in sector 0
|
||||
blkverify: read sector_num=0 nb_sectors=1 contents mismatch in sector 0
|
||||
|
||||
=== Testing blkverify through file blockref ===
|
||||
|
||||
@ -26,7 +26,7 @@ read 512/512 bytes at offset 229376
|
||||
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
wrote 512/512 bytes at offset 0
|
||||
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
blkverify: read sector_num=0 nb_sectors=4 contents mismatch in sector 0
|
||||
blkverify: read sector_num=0 nb_sectors=1 contents mismatch in sector 0
|
||||
|
||||
=== Testing blkdebug through filename ===
|
||||
|
||||
@ -61,7 +61,7 @@ blkverify: read sector_num=0 nb_sectors=1 contents mismatch in sector 0
|
||||
|
||||
=== Testing blkverify on existing raw block device ===
|
||||
|
||||
Testing: -drive file=TEST_DIR/t.IMGFMT.base,if=none,id=drive0
|
||||
Testing: -drive file=TEST_DIR/t.IMGFMT.base,format=raw,if=none,id=drive0
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
|
@ -52,7 +52,7 @@ echo "== Some concurrent requests involving RMW =="
|
||||
|
||||
function test_io()
|
||||
{
|
||||
echo "open -o file.align=4k blkdebug::$TEST_IMG"
|
||||
echo "open -o driver=$IMGFMT,file.align=4k blkdebug::$TEST_IMG"
|
||||
# A simple RMW request
|
||||
cat <<EOF
|
||||
aio_write -P 10 0x200 0x200
|
||||
|
@ -59,9 +59,13 @@ function run_qemu()
|
||||
test_quorum=$($QEMU_IMG --help|grep quorum)
|
||||
[ "$test_quorum" = "" ] && _supported_fmt quorum
|
||||
|
||||
quorum="file.driver=quorum,file.children.0.file.filename=$TEST_DIR/1.raw"
|
||||
quorum="driver=raw,file.driver=quorum,file.vote-threshold=2"
|
||||
quorum="$quorum,file.children.0.file.filename=$TEST_DIR/1.raw"
|
||||
quorum="$quorum,file.children.1.file.filename=$TEST_DIR/2.raw"
|
||||
quorum="$quorum,file.children.2.file.filename=$TEST_DIR/3.raw,file.vote-threshold=2"
|
||||
quorum="$quorum,file.children.2.file.filename=$TEST_DIR/3.raw"
|
||||
quorum="$quorum,file.children.0.driver=raw"
|
||||
quorum="$quorum,file.children.1.driver=raw"
|
||||
quorum="$quorum,file.children.2.driver=raw"
|
||||
|
||||
echo
|
||||
echo "== creating quorum files =="
|
||||
|
@ -55,5 +55,5 @@ wrote 10485760/10485760 bytes at offset 0
|
||||
10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
||||
== checking that quorum is broken ==
|
||||
qemu-io: can't open: Could not read image for determining its format: Input/output error
|
||||
read failed: Input/output error
|
||||
*** done
|
||||
|
@ -65,7 +65,8 @@ $QEMU_IO -c 'write -P 42 0 512' -c 'write -P 23 512 512' \
|
||||
|
||||
$QEMU_IMG convert -f raw -O $IMGFMT "$TEST_IMG.base" "$TEST_IMG"
|
||||
|
||||
$QEMU_IO -c 'read -P 42 0 512' -c 'read -P 23 512 512' \
|
||||
$QEMU_IO_PROG --cache $CACHEMODE \
|
||||
-c 'read -P 42 0 512' -c 'read -P 23 512 512' \
|
||||
-c 'read -P 66 1024 512' "json:{
|
||||
\"driver\": \"$IMGFMT\",
|
||||
\"file\": {
|
||||
@ -91,7 +92,8 @@ $QEMU_IO -c 'write -P 42 0x38000 512' "$TEST_IMG" | _filter_qemu_io
|
||||
|
||||
# The "image.filename" part tests whether "a": { "b": "c" } and "a.b": "c" do
|
||||
# the same (which they should).
|
||||
$QEMU_IO -c 'read -P 42 0x38000 512' "json:{
|
||||
$QEMU_IO_PROG --cache $CACHEMODE \
|
||||
-c 'read -P 42 0x38000 512' "json:{
|
||||
\"driver\": \"$IMGFMT\",
|
||||
\"file\": {
|
||||
\"driver\": \"blkdebug\",
|
||||
|
@ -391,7 +391,7 @@ BEGIN { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
|
||||
done
|
||||
|
||||
# Set qemu-io cache mode with $CACHEMODE we have
|
||||
QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --cache $CACHEMODE"
|
||||
QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS -f $IMGFMT --cache $CACHEMODE"
|
||||
|
||||
# Set default options for qemu-img create -o if they were not specified
|
||||
_set_default_imgopts
|
||||
|
Loading…
Reference in New Issue
Block a user