mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
qemu-iotests: 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. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
72bb202583
commit
2547caa169
1 changed files with 40 additions and 27 deletions
|
@ -57,10 +57,10 @@ echo
|
||||||
|
|
||||||
for offset in $TEST_OFFSETS; do
|
for offset in $TEST_OFFSETS; do
|
||||||
# Some clusters with alternating backing file/image file reads
|
# 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
|
# 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
|
done
|
||||||
_check_test_img
|
_check_test_img
|
||||||
|
|
||||||
|
@ -75,15 +75,26 @@ echo
|
||||||
|
|
||||||
for offset in $TEST_OFFSETS; do
|
for offset in $TEST_OFFSETS; do
|
||||||
# Some clusters with alternating backing file/image file reads
|
# 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
|
# 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
|
done
|
||||||
_check_test_img
|
_check_test_img
|
||||||
|
|
||||||
mv $TEST_IMG $TEST_IMG.orig
|
mv $TEST_IMG $TEST_IMG.orig
|
||||||
$QEMU_IMG convert -O $IMGFMT -B $TEST_IMG.base $TEST_IMG.orig $TEST_IMG
|
|
||||||
|
|
||||||
|
|
||||||
|
# Test the conversion twice: One test with the old-style -B option and another
|
||||||
|
# one with -o backing_file
|
||||||
|
|
||||||
|
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 "Checking if backing clusters are allocated when they shouldn't"
|
||||||
echo
|
echo
|
||||||
|
@ -97,18 +108,20 @@ echo
|
||||||
|
|
||||||
for offset in $TEST_OFFSETS; do
|
for offset in $TEST_OFFSETS; do
|
||||||
# Some clusters with alternating backing file/image file reads
|
# Some clusters with alternating backing file/image file reads
|
||||||
io readv $(( offset )) 512 1024 64
|
io_pattern readv $(( offset )) 512 1024 64 42
|
||||||
io readv $(( offset + 512 )) 512 1024 64
|
io_pattern readv $(( offset + 512 )) 512 1024 64 43
|
||||||
|
|
||||||
# Complete test image clusters
|
# Complete test image clusters
|
||||||
io readv $(( offset + 1024 * 1024)) $CLUSTER_SIZE $CLUSTER_SIZE 1
|
io_pattern readv $(( offset + 1024 * 1024)) $CLUSTER_SIZE $CLUSTER_SIZE 1 42
|
||||||
io readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE)) $CLUSTER_SIZE $CLUSTER_SIZE 1
|
io_pattern readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE)) $CLUSTER_SIZE $CLUSTER_SIZE 1 43
|
||||||
|
|
||||||
# Empty sectors
|
# Empty sectors
|
||||||
io_zero readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE * 4 )) $CLUSTER_SIZE $CLUSTER_SIZE 1
|
io_zero readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE * 4 )) $CLUSTER_SIZE $CLUSTER_SIZE 1
|
||||||
done
|
done
|
||||||
_check_test_img
|
_check_test_img
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
# success, all done
|
# success, all done
|
||||||
echo "*** done"
|
echo "*** done"
|
||||||
rm -f $seq.full
|
rm -f $seq.full
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue