aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/221
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2020-12-07 16:22:45 +0100
committerKevin Wolf <kwolf@redhat.com>2020-12-11 17:52:40 +0100
commitf0947dc694e57d6ecb0f5ac3d684bcce8952cdff (patch)
tree6c95c5f4a7cd012c82aad074c4db62533f541eaf /tests/qemu-iotests/221
parenteb43ea16dcb7e6ab01db321b5edac3e593556e7d (diff)
iotests/221: Discard image before qemu-img map
See the new comment for why this should be done. I do not have a reproducer on master, but when using FUSE block exports, this test breaks depending on the underlying filesystem (for me, it works on tmpfs, but fails on xfs, because the block allocated by file-posix has 16 kB there instead of 4 kB). Suggested-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com> Message-Id: <20201207152245.66987-1-mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/221')
-rwxr-xr-xtests/qemu-iotests/2217
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/qemu-iotests/221 b/tests/qemu-iotests/221
index ca62b3baa1..7e6086b205 100755
--- a/tests/qemu-iotests/221
+++ b/tests/qemu-iotests/221
@@ -46,6 +46,13 @@ echo "=== Check mapping of unaligned raw image ==="
echo
_make_test_img 65537 # qemu-img create rounds size up
+
+# file-posix allocates the first block of any images when it is created;
+# the size of this block depends on the host page size and the file
+# system block size, none of which are constant. Discard the whole
+# image so we will not see this allocation in qemu-img map's output.
+$QEMU_IO -c 'discard 0 65537' "$TEST_IMG" | _filter_qemu_io
+
$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map
truncate --size=65537 "$TEST_IMG" # so we resize it and check again