[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 049/113] iotests: Test preallocated truncate of 2G i
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 049/113] iotests: Test preallocated truncate of 2G image |
Date: |
Mon, 18 Jun 2018 20:42:15 -0500 |
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>
(cherry picked from commit 733d1dce0f3c8ab7b79a173f6482781d3718f844)
Signed-off-by: Michael Roth <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.11.0
- [Qemu-devel] [PATCH 039/113] multiboot: fprintf(stderr...) -> error_report(), (continued)
- [Qemu-devel] [PATCH 039/113] multiboot: fprintf(stderr...) -> error_report(), Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 003/113] virtio-balloon: unref the memory region before continuing, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 040/113] multiboot: Reject kernels exceeding the address space, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 041/113] multiboot: Check validity of mh_header_addr, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 042/113] tests/multiboot: Test exit code for every qemu run, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 043/113] tests/multiboot: Add tests for the a.out kludge, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 044/113] tests/multiboot: Add .gitignore, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 046/113] virtio_net: flush uncompleted TX on reset, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 045/113] arm/translate-a64: treat DISAS_UPDATE as variant of DISAS_EXIT, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 047/113] qemu-pr-helper: Actually allow users to specify pidfile, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 049/113] iotests: Test preallocated truncate of 2G image,
Michael Roth <=
- [Qemu-devel] [PATCH 048/113] block/file-posix: Fix fully preallocated truncate, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 050/113] tcg: Mark muluh_i64 and mulsh_i64 as 64-bit ops, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 004/113] memfd: fix configure test, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 051/113] target/i386: Fix andn instruction, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 054/113] cpus.c: ensure running CPU recalculates icount deadlines on timer expiry, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 052/113] exec: fix memory leak in find_max_supported_pagesize(), Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 053/113] gluster: Fix blockdev-add with server.N.type=unix, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 056/113] hw/block/pflash_cfi: fix off-by-one error, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 057/113] tcg: Introduce tcg_set_insn_start_param, Michael Roth, 2018/06/18
- [Qemu-devel] [PATCH 059/113] device_tree: Increase FDT_MAX_SIZE to 1 MiB, Michael Roth, 2018/06/18