Improve test for qemu-img convert with backing file
PATCH v2 1/1 Improve test for qemu-img convert with backing file
Additionally to testing the qemu-img convert -B option, also test -o backing_file.
Also, the old test acidentlly used a pattern of zeros for most of the writes, so that the allocation test didn't really work out. This is fixed by using an explicit pattern.
---
v2:
- Include changes to 019.out to contain the expected output for the new script. The test still fails on git master, but that's a real qemu-img bug.
019 | 59 ++++--- 019.out | 577 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 598 insertions(+), 38 deletions(-)
019 +36 -23
@@ -57,10 +57,10 @@ echo for offset in $TEST_OFFSETS; do # Some clusters with alternating backing file/image file reads - io writev $(( offset )) 512 1024 64 + io_pattern writev $(( offset )) 512 1024 64 42 # Complete backing clusters - io writev $(( offset + 1024 * 1024)) $CLUSTER_SIZE $CLUSTER_SIZE 1 + io_pattern writev $(( offset + 1024 * 1024)) $CLUSTER_SIZE $CLUSTER_SIZE 1 42 done _check_test_img
@@ -75,39 +75,52 @@ echo for offset in $TEST_OFFSETS; do # Some clusters with alternating backing file/image file reads - io writev $(( offset + 512 )) 512 1024 64 + io_pattern writev $(( offset + 512 )) 512 1024 64 43 # Complete test image clusters - io writev $(( offset + 1024 * 1024 + $CLUSTER_SIZE)) $CLUSTER_SIZE $CLUSTER_SIZE 1 + io_pattern writev $(( offset + 1024 * 1024 + $CLUSTER_SIZE)) $CLUSTER_SIZE $CLUSTER_SIZE 1 43 done _check_test_img mv $TEST_IMG $TEST_IMG.orig -$QEMU_IMG convert -O $IMGFMT -B $TEST_IMG.base $TEST_IMG.orig $TEST_IMG -echo "Checking if backing clusters are allocated when they shouldn't" -echo -for offset in $TEST_OFFSETS; do - # Complete backing clusters - is_allocated $(( offset + 1024 * 1024)) $CLUSTER_SIZE $CLUSTER_SIZE 1 -done -echo "Reading" -echo -for offset in $TEST_OFFSETS; do - # Some clusters with alternating backing file/image file reads - io readv $(( offset )) 512 1024 64 - io readv $(( offset + 512 )) 512 1024 64 +# Test the conversion twice: One test with the old-style -B option and another +# one with -o backing_file - # Complete test image clusters - io readv $(( offset + 1024 * 1024)) $CLUSTER_SIZE $CLUSTER_SIZE 1 - io readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE)) $CLUSTER_SIZE $CLUSTER_SIZE 1 +for backing_option in "-B $TEST_IMG.base" "-o backing_file=$TEST_IMG.base"; do + + echo + echo Testing conversion with $backing_option + echo + $QEMU_IMG convert -O $IMGFMT $backing_option $TEST_IMG.orig $TEST_IMG + + echo "Checking if backing clusters are allocated when they shouldn't" + echo + for offset in $TEST_OFFSETS; do + # Complete backing clusters + is_allocated $(( offset + 1024 * 1024)) $CLUSTER_SIZE $CLUSTER_SIZE 1 + done + + echo "Reading" + echo + + for offset in $TEST_OFFSETS; do + # Some clusters with alternating backing file/image file reads + io_pattern readv $(( offset )) 512 1024 64 42 + io_pattern readv $(( offset + 512 )) 512 1024 64 43 + + # Complete test image clusters + io_pattern readv $(( offset + 1024 * 1024)) $CLUSTER_SIZE $CLUSTER_SIZE 1 42 + io_pattern readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE)) $CLUSTER_SIZE $CLUSTER_SIZE 1 43 + + # Empty sectors + io_zero readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE * 4 )) $CLUSTER_SIZE $CLUSTER_SIZE 1 + done + _check_test_img - # Empty sectors - io_zero readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE * 4 )) $CLUSTER_SIZE $CLUSTER_SIZE 1 done -_check_test_img # success, all done echo "*** done"
019.out +562 -15
660 lines not on this page · raw message
Signature · 1 line
1.7.2.3
Quoted 7 lines · Kevin Wolf
Additionally to testing the qemu-img convert -B option, also test -o
backing_file.Also, the old test acidentlly used a pattern of zeros for most of the writes, so that the allocation test didn't really work out. This is fixed by using an explicit pattern.
Quoted 5 lines
Signed-off-by Kevin Wolf <[email protected]>---
v2:
- Include changes to 019.out to contain the expected output for the new script. The test still fails on git master, but that's a real qemu-img bug.
I'd rather wait adding more testing until it actually works. The alternative would be to move the test for the new option into a separate test case.
Am 15.10.2010 23:11, schrieb Christoph Hellwig:
Quoted 14 lines · Kevin Wolf
Quoted 7 lines
Additionally to testing the qemu-img convert -B option, also test -o
backing_file.Also, the old test acidentlly used a pattern of zeros for most of the writes, so that the allocation test didn't really work out. This is fixed by using an explicit pattern.
Quoted 5 lines
Signed-off-by Kevin Wolf <[email protected]>---
v2:
- Include changes to 019.out to contain the expected output for the new script. The test still fails on git master, but that's a real qemu-img bug.
Quoted 3 lines
I'd rather wait adding more testing until it actually works. The alternative would be to move the test for the new option into a separate test case.
It's going to get forgotten this way, but it's your decision. Certainly at some point I'll notice that I have a local patch that isn't applied yet and I can resend it then.
Kevin