summaryrefslogtreecommitdiffstats
path: root/tests/qemu-iotests/033
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2015-03-24 09:23:50 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2015-03-27 10:01:12 +0000
commit61815d6e0aa1a549ad55f6621b6816aa6b1ab757 (patch)
treec4aa83a47735768ab17c93cca8006e2929ca5047 /tests/qemu-iotests/033
parentfc3959e4669a1c2149b91ccb05101cfc7ae1fc05 (diff)
downloadhqemu-61815d6e0aa1a549ad55f6621b6816aa6b1ab757.zip
hqemu-61815d6e0aa1a549ad55f6621b6816aa6b1ab757.tar.gz
qemu-iotests: Test unaligned 4k zero write
Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1427160230-4489-3-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/033')
-rwxr-xr-xtests/qemu-iotests/03347
1 files changed, 30 insertions, 17 deletions
diff --git a/tests/qemu-iotests/033 b/tests/qemu-iotests/033
index ea3351c..4008f10 100755
--- a/tests/qemu-iotests/033
+++ b/tests/qemu-iotests/033
@@ -46,26 +46,39 @@ _supported_os Linux
size=128M
_make_test_img $size
-echo
-echo "== preparing image =="
-$QEMU_IO -c "write -P 0xa 0x200 0x400" "$TEST_IMG" | _filter_qemu_io
-$QEMU_IO -c "write -P 0xa 0x20000 0x600" "$TEST_IMG" | _filter_qemu_io
-$QEMU_IO -c "write -z 0x400 0x20000" "$TEST_IMG" | _filter_qemu_io
+do_test()
+{
+ local align=$1
+ local iocmd=$2
+ local img=$3
+ {
+ echo "open -o driver=$IMGFMT,file.align=$align blkdebug::$img"
+ echo $iocmd
+ } | $QEMU_IO
+}
+
+for align in 512 4k; do
+ echo
+ echo "== preparing image =="
+ do_test $align "write -P 0xa 0x200 0x400" "$TEST_IMG" | _filter_qemu_io
+ do_test $align "write -P 0xa 0x20000 0x600" "$TEST_IMG" | _filter_qemu_io
+ do_test $align "write -z 0x400 0x20000" "$TEST_IMG" | _filter_qemu_io
-echo
-echo "== verifying patterns (1) =="
-$QEMU_IO -c "read -P 0xa 0x200 0x200" "$TEST_IMG" | _filter_qemu_io
-$QEMU_IO -c "read -P 0x0 0x400 0x20000" "$TEST_IMG" | _filter_qemu_io
-$QEMU_IO -c "read -P 0xa 0x20400 0x200" "$TEST_IMG" | _filter_qemu_io
+ echo
+ echo "== verifying patterns (1) =="
+ do_test $align "read -P 0xa 0x200 0x200" "$TEST_IMG" | _filter_qemu_io
+ do_test $align "read -P 0x0 0x400 0x20000" "$TEST_IMG" | _filter_qemu_io
+ do_test $align "read -P 0xa 0x20400 0x200" "$TEST_IMG" | _filter_qemu_io
-echo
-echo "== rewriting zeroes =="
-$QEMU_IO -c "write -P 0xb 0x10000 0x10000" "$TEST_IMG" | _filter_qemu_io
-$QEMU_IO -c "write -z 0x10000 0x10000" "$TEST_IMG" | _filter_qemu_io
+ echo
+ echo "== rewriting zeroes =="
+ do_test $align "write -P 0xb 0x10000 0x10000" "$TEST_IMG" | _filter_qemu_io
+ do_test $align "write -z 0x10000 0x10000" "$TEST_IMG" | _filter_qemu_io
-echo
-echo "== verifying patterns (2) =="
-$QEMU_IO -c "read -P 0x0 0x400 0x20000" "$TEST_IMG" | _filter_qemu_io
+ echo
+ echo "== verifying patterns (2) =="
+ do_test $align "read -P 0x0 0x400 0x20000" "$TEST_IMG" | _filter_qemu_io
+done
# success, all done
echo "*** done"
OpenPOWER on IntegriCloud