aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2023-03-12 10:56:23 +0000
committerPeter Maydell <peter.maydell@linaro.org>2023-03-12 10:56:23 +0000
commit0d622f8b320fe5d2e6102da2721ae47156146baf (patch)
tree3942fa274db6af628630dd487e4d87b7f515d1d8 /tests
parentee41280a93003583e44015ac93ca737de9c8ae3a (diff)
parentecf8191314798391b1df80bcb829c0ead4f8acc9 (diff)
downloadqemu-0d622f8b320fe5d2e6102da2721ae47156146baf.zip
qemu-0d622f8b320fe5d2e6102da2721ae47156146baf.tar.gz
qemu-0d622f8b320fe5d2e6102da2721ae47156146baf.tar.bz2
Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging
Block layer patches - fuse: Fix fallocate(PUNCH_HOLE) to zero out the range - qed: remove spurious BDRV_POLL_WHILE() # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmQLbtURHGt3b2xmQHJl # ZGhhdC5jb20ACgkQfwmycsiPL9YekQ//SvVXzKbQCNoKJtbkmx9RYSVZt3C19Nfy # +E3vUauBMvO1RA38J+ff3pBp7R2rWu1QQXZCVu0a5bg7R2cYSKs82Ua5Z6SG9KxZ # TZSGw2vsYk5pcRJwUS+4lGkvV4zrUsm7gru5h+aL51YS20AaPfSaa/kKKMuWWabm # O/7ct/gQdiH+8I3d1WpXTE69ZJoH6WK87TUg9HgdQWPwDgam0gbNEjsGjKioCKIz # xuz28v1UufXL2PRIWmPh4X+XSvD81q3adgf+vM5tWOaeAL87Q0eLeyiAI0UrvE64 # X9IGsiDcbM3PaLSlZPborg/yDatWjnnBimbxAMuT7d4pbZXjbYPBOeLR7zPJQ2qQ # x/sFgiAVGiR6pgWIC85E2rIsWfBIEAla/YowZRdNmCO7ar82wBhoGdUQx6nHP18U # eJg50EhX9Fhf5kMt3tZf4AaJzn48QsBA+O7PKbc/DZBLrthOLKzyLM6SusbpBG8g # jFsdlDYMy9dIB6g3BC6fwZAqQNqbEMlU63ZvQzeq5yPpjFyS5H3IGHLzDiYg/9m6 # WdRUM/wQKkq0YwF1OumQ+Uu8ClTJPDi/177+hOyQeIFZao3NgznDtA12rNroYOU2 # pDIff9K9gwOFFNmDDtsjm8h967pF7RJMZylvNilT+7xkMy2kwYdCo76TBYDyN8Kk # aYBIDpWtPps= # =PUFU # -----END PGP SIGNATURE----- # gpg: Signature made Fri 10 Mar 2023 17:54:29 GMT # gpg: using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6 # gpg: issuer "kwolf@redhat.com" # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full] # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * tag 'for-upstream' of https://repo.or.cz/qemu/kevin: qed: remove spurious BDRV_POLL_WHILE() iotests/308: Add test for 'write -zu' block/fuse: Let PUNCH_HOLE write zeroes Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/qemu-iotests/30843
-rw-r--r--tests/qemu-iotests/308.out35
2 files changed, 78 insertions, 0 deletions
diff --git a/tests/qemu-iotests/308 b/tests/qemu-iotests/308
index 09275e9..de12b2b 100755
--- a/tests/qemu-iotests/308
+++ b/tests/qemu-iotests/308
@@ -370,6 +370,49 @@ echo
echo '=== Compare copy with original ==='
$QEMU_IMG compare -f raw -F $IMGFMT "$COPIED_IMG" "$TEST_IMG"
+_cleanup_test_img
+
+echo
+echo '=== Writing zeroes while unmapping ==='
+# Regression test for https://gitlab.com/qemu-project/qemu/-/issues/1507
+_make_test_img 64M
+$QEMU_IO -c 'write -s /dev/urandom 0 64M' "$TEST_IMG" | _filter_qemu_io
+
+_launch_qemu
+_send_qemu_cmd $QEMU_HANDLE \
+ "{'execute': 'qmp_capabilities'}" \
+ 'return'
+
+_send_qemu_cmd $QEMU_HANDLE \
+ "{'execute': 'blockdev-add',
+ 'arguments': {
+ 'driver': '$IMGFMT',
+ 'node-name': 'node-format',
+ 'file': {
+ 'driver': 'file',
+ 'filename': '$TEST_IMG'
+ }
+ } }" \
+ 'return'
+
+fuse_export_add 'export' "'mountpoint': '$EXT_MP', 'writable': true"
+
+# Try writing zeroes by unmapping
+$QEMU_IO -f raw -c 'write -zu 0 64M' "$EXT_MP" | _filter_qemu_io
+
+# Check the result
+$QEMU_IO -f raw -c 'read -P 0 0 64M' "$EXT_MP" | _filter_qemu_io
+
+_send_qemu_cmd $QEMU_HANDLE \
+ "{'execute': 'quit'}" \
+ 'return'
+
+wait=yes _cleanup_qemu
+
+# Check the original image
+$QEMU_IO -c 'read -P 0 0 64M' "$TEST_IMG" | _filter_qemu_io
+
+_cleanup_test_img
# success, all done
echo "*** done"
diff --git a/tests/qemu-iotests/308.out b/tests/qemu-iotests/308.out
index e4467a1..d576713 100644
--- a/tests/qemu-iotests/308.out
+++ b/tests/qemu-iotests/308.out
@@ -171,4 +171,39 @@ OK: Post-truncate image size is as expected
=== Compare copy with original ===
Images are identical.
+
+=== Writing zeroes while unmapping ===
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
+wrote 67108864/67108864 bytes at offset 0
+64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+{'execute': 'qmp_capabilities'}
+{"return": {}}
+{'execute': 'blockdev-add',
+ 'arguments': {
+ 'driver': 'IMGFMT',
+ 'node-name': 'node-format',
+ 'file': {
+ 'driver': 'file',
+ 'filename': 'TEST_DIR/t.IMGFMT'
+ }
+ } }
+{"return": {}}
+{'execute': 'block-export-add',
+ 'arguments': {
+ 'type': 'fuse',
+ 'id': 'export',
+ 'node-name': 'node-format',
+ 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse', 'writable': true
+ } }
+{"return": {}}
+wrote 67108864/67108864 bytes at offset 0
+64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 67108864/67108864 bytes at offset 0
+64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+{'execute': 'quit'}
+{"return": {}}
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "export"}}
+read 67108864/67108864 bytes at offset 0
+64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
*** done