[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 23/37] iotest 033: add misaligned write-zeroes test v
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 23/37] iotest 033: add misaligned write-zeroes test via truncate |
Date: |
Fri, 2 Mar 2018 19:54:34 +0100 |
From: Anton Nefedov <address@hidden>
This new test case only makes sense for qcow2 while iotest 033 is generic;
however it matches the test purpose perfectly and also 033 contains those
do_test() tricks to pass the alignment, which won't look nice being
duplicated in other tests or moved to the common code.
Signed-off-by: Anton Nefedov <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
tests/qemu-iotests/033 | 29 +++++++++++++++++++++++++++++
tests/qemu-iotests/033.out | 13 +++++++++++++
2 files changed, 42 insertions(+)
diff --git a/tests/qemu-iotests/033 b/tests/qemu-iotests/033
index 2cdfd1397a..a1d8357331 100755
--- a/tests/qemu-iotests/033
+++ b/tests/qemu-iotests/033
@@ -64,6 +64,9 @@ do_test()
} | $QEMU_IO $IO_EXTRA_ARGS
}
+echo
+echo "=== Test aligned and misaligned write zeroes operations ==="
+
for write_zero_cmd in "write -z" "aio_write -z"; do
for align in 512 4k; do
echo
@@ -102,7 +105,33 @@ for align in 512 4k; do
done
done
+
+# Trigger truncate that would shrink qcow2 L1 table, which is done by
+# clearing one entry (8 bytes) with bdrv_co_pwrite_zeroes()
+
+echo
+echo "=== Test misaligned write zeroes via truncate ==="
+echo
+
+# any size will do, but the smaller the size the smaller the required image
+CLUSTER_SIZE=$((4 * 1024))
+L2_COVERAGE=$(($CLUSTER_SIZE * $CLUSTER_SIZE / 8))
+_make_test_img $(($L2_COVERAGE * 2))
+
+do_test 512 "write -P 1 0 0x200" "$TEST_IMG" | _filter_qemu_io
+# next L2 table
+do_test 512 "write -P 1 $L2_COVERAGE 0x200" "$TEST_IMG" | _filter_qemu_io
+
+# only interested in qcow2 here; also other formats might respond with
+# "not supported" error message
+if [ $IMGFMT = "qcow2" ]; then
+ do_test 512 "truncate $L2_COVERAGE" "$TEST_IMG" | _filter_qemu_io
+fi
+
+do_test 512 "read -P 1 0 0x200" "$TEST_IMG" | _filter_qemu_io
+
# success, all done
+echo
echo "*** done"
rm -f $seq.full
status=0
diff --git a/tests/qemu-iotests/033.out b/tests/qemu-iotests/033.out
index 95929eff70..9683f6b290 100644
--- a/tests/qemu-iotests/033.out
+++ b/tests/qemu-iotests/033.out
@@ -1,6 +1,8 @@
QA output created by 033
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
+=== Test aligned and misaligned write zeroes operations ===
+
== preparing image ==
wrote 1024/1024 bytes at offset 512
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
@@ -164,4 +166,15 @@ read 512/512 bytes at offset 512
read 3072/3072 bytes at offset 1024
3 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
+=== Test misaligned write zeroes via truncate ===
+
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4194304
+wrote 512/512 bytes at offset 0
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 512/512 bytes at offset 2097152
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 512/512 bytes at offset 0
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
*** done
--
2.13.6
- [Qemu-devel] [PULL 13/37] qed: Switch to .bdrv_co_block_status(), (continued)
- [Qemu-devel] [PULL 13/37] qed: Switch to .bdrv_co_block_status(), Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 14/37] raw: Switch to .bdrv_co_block_status(), Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 15/37] sheepdog: Switch to .bdrv_co_block_status(), Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 16/37] vdi: Avoid bitrot of debugging code, Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 17/37] vdi: Switch to .bdrv_co_block_status(), Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 18/37] vmdk: Switch to .bdrv_co_block_status(), Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 19/37] vpc: Switch to .bdrv_co_block_status(), Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 20/37] vvfat: Switch to .bdrv_co_block_status(), Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 22/37] block: fix write with zero flag set and iovector provided, Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 21/37] block: Drop unused .bdrv_co_get_block_status(), Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 23/37] iotest 033: add misaligned write-zeroes test via truncate,
Kevin Wolf <=
- [Qemu-devel] [PULL 26/37] aio: rename aio_context_in_iothread() to in_aio_context_home_thread(), Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 25/37] docs: document how to use the l2-cache-entry-size parameter, Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 24/37] specs/qcow2: Fix documentation of the compressed cluster descriptor, Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 28/37] block: add BlockBackend->in_flight counter, Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 27/37] block: extract AIO_WAIT_WHILE() from BlockDriverState, Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 30/37] Revert "IDE: Do not flush empty CDROM drives", Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 29/37] block: test blk_aio_flush() with blk->root == NULL, Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 32/37] qcow2: make qcow2_co_create2() a coroutine_fn, Kevin Wolf, 2018/03/02
- [Qemu-devel] [PULL 33/37] qemu-img: Make resize error message more general, Kevin Wolf, 2018/03/02