I tested this change:
$ git diff
diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175
index d0ffc495c2..0e3faa50e4 100755
--- a/tests/qemu-iotests/175
+++ b/tests/qemu-iotests/175
@@ -43,17 +43,17 @@ _supported_os Linux
size=1m
echo
echo "== creating image with default preallocation =="
_make_test_img $size | _filter_imgfmt
-stat -c "size=%s, blocks=%b" $TEST_IMG
+$QEMU_IMG map -f $IMGFMT --output json "$TEST_IMG"
for mode in off full falloc; do
echo
echo "== creating image with preallocation $mode =="
IMGOPTS=preallocation=$mode _make_test_img $size | _filter_imgfmt
- stat -c "size=%s, blocks=%b" $TEST_IMG
+ $QEMU_IMG map -f $IMGFMT --output json "$TEST_IMG"
done
# success, all done
echo "*** done"
rm -f $seq.full
It almost works:
$ ./check -raw 175
QEMU -- "/home/nsoffer/src/qemu/build/tests/qemu-iotests/../../x86_64-softmmu/qemu-system-x86_64" -nodefaults -machine accel=qtest
QEMU_IMG -- "/home/nsoffer/src/qemu/build/tests/qemu-iotests/../../qemu-img"
QEMU_IO -- "/home/nsoffer/src/qemu/build/tests/qemu-iotests/../../qemu-io" --cache writeback -f raw
QEMU_NBD -- "/home/nsoffer/src/qemu/build/tests/qemu-iotests/../../qemu-nbd"
IMGFMT -- raw
IMGPROTO -- file
PLATFORM -- Linux/x86_64 lean 5.0.11-100.fc28.x86_64
TEST_DIR -- /home/nsoffer/src/qemu/build/tests/qemu-iotests/scratch
SOCKET_SCM_HELPER -- /home/nsoffer/src/qemu/build/tests/qemu-iotests/socket_scm_helper
175 - output mismatch (see 175.out.bad)
--- /home/nsoffer/src/qemu/tests/qemu-iotests/175.out 2019-03-23 18:35:17.788177871 +0200
+++ /home/nsoffer/src/qemu/build/tests/qemu-iotests/175.out.bad 2019-05-11 00:06:09.515873624 +0300
@@ -2,17 +2,17 @@
== creating image with default preallocation ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
-size=1048576, blocks=0
+[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false, "offset": 0}]
== creating image with preallocation off ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=off
-size=1048576, blocks=0
+[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false, "offset": 0}]
== creating image with preallocation full ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=full
-size=1048576, blocks=2048
+[{ "start": 0, "length": 1048576, "depth": 0, "zero": false, "data": true, "offset": 0}]
== creating image with preallocation falloc ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=falloc
-size=1048576, blocks=2048
+[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false, "offset": 0}]
The "falloc" test looks exactly like "off", qemu-img map does not report the allocation
status.