|
@@ -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
|
|
$QEMU_IMG resize -f "$IMGFMT" --shrink --preallocation=$growth_mode "$TEST_IMG" -${GROWTH_SIZE}K
|
|
done
|
|
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
|
|
# success, all done
|
|
echo '*** done'
|
|
echo '*** done'
|
|
rm -f $seq.full
|
|
rm -f $seq.full
|