summaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/150
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2016-03-29 18:24:17 +0200
committerKevin Wolf <kwolf@redhat.com>2016-04-12 18:06:51 +0200
commit1fd06db03da73db868e54b838bb5ea02c10eea6c (patch)
tree8e76168587ec5ddf8f913e764af10706223e1b3c /tests/qemu-iotests/150
parentc229708848cc77b0277e7260f7e739d441c1d086 (diff)
downloadqemu-1fd06db03da73db868e54b838bb5ea02c10eea6c.tar.gz
iotests: Make 150 use qemu-img map instead of du
The actual on-disk size of a file does not only depend on factors qemu can control. Thus, we should not depend on this to determine whether a file has indeed been fully allocated. Instead, use qemu-img map and hope that if an area is referenced, it is indeed allocated, too. Also, limit the supported image formats to raw and qcow2 because the actual qemu-img map output may depend on the image format. Signed-off-by: Max Reitz <mreitz@redhat.com> Tested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/150')
-rwxr-xr-xtests/qemu-iotests/15041
1 files changed, 5 insertions, 36 deletions
diff --git a/tests/qemu-iotests/150 b/tests/qemu-iotests/150
index 97d2a35bfc..665373deb0 100755
--- a/tests/qemu-iotests/150
+++ b/tests/qemu-iotests/150
@@ -38,65 +38,34 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
. ./common.rc
. ./common.filter
-_supported_fmt generic
+_supported_fmt raw qcow2
_supported_proto file
_supported_os Linux
-on_disk_size()
-{
- du "$@" | sed -e 's/\t\+.*//'
-}
-
-
img_size=1048576
echo
-echo '=== Comparing empty image against sparse conversion ==='
+echo '=== Mapping sparse conversion ==='
echo
-_make_test_img $img_size
-
-empty_size=$(on_disk_size "$TEST_IMG")
-
-
$QEMU_IMG_PROG convert -O "$IMGFMT" -S 512 \
"json:{ 'driver': 'null-co', 'size': $img_size, 'read-zeroes': true }" \
"$TEST_IMG"
-sparse_convert_size=$(on_disk_size "$TEST_IMG")
-
-
-if [ "$empty_size" -eq "$sparse_convert_size" ]; then
- echo 'Equal image size'
-else
- echo 'Different image size'
-fi
+$QEMU_IMG map "$TEST_IMG" | _filter_qemu_img_map
echo
-echo '=== Comparing full image against non-sparse conversion ==='
+echo '=== Mapping non-sparse conversion ==='
echo
-_make_test_img $img_size
-$QEMU_IO -c "write 0 $img_size" "$TEST_IMG" | _filter_qemu_io
-
-full_size=$(on_disk_size "$TEST_IMG")
-
-
$QEMU_IMG convert -O "$IMGFMT" -S 0 \
"json:{ 'driver': 'null-co', 'size': $img_size, 'read-zeroes': true }" \
"$TEST_IMG"
-non_sparse_convert_size=$(on_disk_size "$TEST_IMG")
-
-
-if [ "$full_size" -eq "$non_sparse_convert_size" ]; then
- echo 'Equal image size'
-else
- echo 'Different image size'
-fi
+$QEMU_IMG map "$TEST_IMG" | _filter_qemu_img_map
# success, all done