[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 7/9] iotests: Test preallocated truncate of 2G image
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 7/9] iotests: Test preallocated truncate of 2G image |
Date: |
Tue, 3 Apr 2018 18:33:58 +0200 |
From: Max Reitz <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Reviewed-by: Daniel P. Berrangé <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/106 | 24 ++++++++++++++++++++++++
tests/qemu-iotests/106.out | 10 ++++++++++
2 files changed, 34 insertions(+)
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
diff --git a/tests/qemu-iotests/106.out b/tests/qemu-iotests/106.out
index 0a42312301..c459957660 100644
--- a/tests/qemu-iotests/106.out
+++ b/tests/qemu-iotests/106.out
@@ -47,4 +47,14 @@ qemu-img: Preallocation can only be used for growing images
--- growth_mode=off ---
Image resized.
+
+=== Testing image growth on 2G empty image ===
+
+--- growth_mode=falloc ---
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648
+Image resized.
+
+--- growth_mode=full ---
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648
+Image resized.
*** done
--
2.13.6
- [Qemu-devel] [PULL 0/9] Block layer patches for 2.12.0-rc2, Kevin Wolf, 2018/04/03
- [Qemu-devel] [PULL 1/9] gluster: Fix blockdev-add with server.N.type=unix, Kevin Wolf, 2018/04/03
- [Qemu-devel] [PULL 3/9] iotests: Update 051 and 186 after commit 1454509726719e0933c, Kevin Wolf, 2018/04/03
- [Qemu-devel] [PULL 7/9] iotests: Test preallocated truncate of 2G image,
Kevin Wolf <=
- [Qemu-devel] [PULL 5/9] iotests: fix 208 for luks format, Kevin Wolf, 2018/04/03
- [Qemu-devel] [PULL 4/9] iotests: Update 186 after commit ac64273c66ab136c44043259162, Kevin Wolf, 2018/04/03
- [Qemu-devel] [PULL 8/9] qemu-iotests: Use ppc64 qemu_arch on ppc64le host, Kevin Wolf, 2018/04/03
- [Qemu-devel] [PULL 2/9] block: handle invalid lseek returns gracefully, Kevin Wolf, 2018/04/03
- [Qemu-devel] [PULL 6/9] block/file-posix: Fix fully preallocated truncate, Kevin Wolf, 2018/04/03
- [Qemu-devel] [PULL 9/9] iotests: Test abnormally large size in compressed cluster descriptor, Kevin Wolf, 2018/04/03
- Re: [Qemu-devel] [PULL 0/9] Block layer patches for 2.12.0-rc2, Peter Maydell, 2018/04/04