summaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/106
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-04-03 17:48:45 +0200
committerKevin Wolf <kwolf@redhat.com>2018-04-03 17:48:45 +0200
commit9c1386d3ff76c5983529884e3d8420df958c5a29 (patch)
tree4a78266d8ebbfa59a65a441b89070b3708089053 /tests/qemu-iotests/106
parenteb42e7193e74a8e51603d0190340d4983eb58002 (diff)
parentabd3622cc03cf41ed542126a540385f30a4c0175 (diff)
downloadqemu-9c1386d3ff76c5983529884e3d8420df958c5a29.tar.gz
Merge remote-tracking branch 'mreitz/tags/pull-block-2018-04-03' into queue-block
A fix for preallocated truncation, a new iotest, and a fix to make the iotests work more comfortably on ppc64 # gpg: Signature made Tue Apr 3 17:40:57 2018 CEST # gpg: using RSA key F407DB0061D5CF40 # gpg: Good signature from "Max Reitz <mreitz@redhat.com>" # Primary key fingerprint: 91BE B60A 30DB 3E88 57D1 1829 F407 DB00 61D5 CF40 * mreitz/tags/pull-block-2018-04-03: iotests: Test abnormally large size in compressed cluster descriptor qemu-iotests: Use ppc64 qemu_arch on ppc64le host iotests: Test preallocated truncate of 2G image block/file-posix: Fix fully preallocated truncate Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/106')
-rwxr-xr-xtests/qemu-iotests/10624
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/qemu-iotests/106 b/tests/qemu-iotests/106
index bfe71f4e60..5e51f88a78 100755
--- a/tests/qemu-iotests/106
+++ b/tests/qemu-iotests/106
@@ -86,6 +86,30 @@ for growth_mode in falloc full off; do
$QEMU_IMG resize -f "$IMGFMT" --shrink --preallocation=$growth_mode "$TEST_IMG" -${GROWTH_SIZE}K
done
+echo
+echo '=== Testing image growth on 2G empty image ==='
+
+for growth_mode in falloc full; do
+ echo
+ echo "--- growth_mode=$growth_mode ---"
+
+ # Maybe we want to do an lseek() to the end of the file before the
+ # preallocation; if the file has a length of 2 GB, that would
+ # return an integer that overflows to negative when put into a
+ # plain int. We should use the correct type for the result, and
+ # this tests we do.
+
+ _make_test_img 2G
+ $QEMU_IMG resize -f "$IMGFMT" --preallocation=$growth_mode "$TEST_IMG" +${GROWTH_SIZE}K
+
+ actual_size=$($QEMU_IMG info -f "$IMGFMT" "$TEST_IMG" | grep 'disk size')
+ actual_size=$(echo "$actual_size" | sed -e 's/^[^0-9]*\([0-9]\+\).*$/\1/')
+
+ if [ $actual_size -lt $GROWTH_SIZE ]; then
+ echo "ERROR: Image should have at least ${GROWTH_SIZE}K, but has ${actual_size}K"
+ fi
+done
+
# success, all done
echo '*** done'
rm -f $seq.full