From 0e72078128229bf9efb542e396ab44bf91b91340 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Thu, 17 Dec 2020 16:38:03 +0100 Subject: iotests: Fix _send_qemu_cmd with bash 5.1 With bash 5.1, the output of the following script changes: a=("double space") a=${a[@]:0:1} echo "$a" from "double space" to "double space", i.e. all white space is preserved as-is. This is probably what we actually want here (judging from the "...to accommodate pathnames with spaces" comment), but before 5.1, we would have to quote the ${} slice to get the same behavior. In any case, without quoting, the reference output of many iotests is different between bash 5.1 and pre-5.1, which is not very good. The output of 5.1 is what we want, so whatever we do to get pre-5.1 to the same result, it means we have to fix the reference output of basically all tests that invoke _send_qemu_cmd (except the ones that only use single spaces in the commands they invoke). Instead of quoting the ${} slice (cmd="${$@: 1:...}"), we can also just not use array slicing and replace the whole thing with a simple "cmd=$1; shift", which works because all callers quote the whole $cmd argument anyway. Signed-off-by: Max Reitz Message-Id: <20201217153803.101231-3-mreitz@redhat.com> Reviewed-by: Kevin Wolf --- tests/qemu-iotests/223.out | 92 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 65 insertions(+), 27 deletions(-) (limited to 'tests/qemu-iotests/223.out') diff --git a/tests/qemu-iotests/223.out b/tests/qemu-iotests/223.out index f6eac23f04..bbc85289e3 100644 --- a/tests/qemu-iotests/223.out +++ b/tests/qemu-iotests/223.out @@ -26,31 +26,48 @@ wrote 2097152/2097152 bytes at offset 2097152 {"execute":"qmp_capabilities"} {"return": {}} -{"execute":"blockdev-add", "arguments":{"driver":"IMGFMT", "node-name":"n", "file":{"driver":"file", "filename":"TEST_DIR/t.IMGFMT"}}} +{"execute":"blockdev-add", + "arguments":{"driver":"IMGFMT", "node-name":"n", + "file":{"driver":"file", "filename":"TEST_DIR/t.IMGFMT"}}} {"return": {}} -{"execute":"block-dirty-bitmap-disable", "arguments":{"node":"n", "name":"b"}} +{"execute":"block-dirty-bitmap-disable", + "arguments":{"node":"n", "name":"b"}} {"return": {}} === Set up NBD with normal access === -{"execute":"nbd-server-add", "arguments":{"device":"n"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n"}} {"error": {"class": "GenericError", "desc": "NBD server not running"}} -{"execute":"nbd-server-start", "arguments":{"addr":{"type":"unix", "data":{"path":"SOCK_DIR/nbd"}}}} +{"execute":"nbd-server-start", + "arguments":{"addr":{"type":"unix", + "data":{"path":"SOCK_DIR/nbd"}}}} {"return": {}} -{"execute":"nbd-server-start", "arguments":{"addr":{"type":"unix", "data":{"path":"SOCK_DIR/nbd1"}}}} +{"execute":"nbd-server-start", + "arguments":{"addr":{"type":"unix", + "data":{"path":"SOCK_DIR/nbd1"}}}} {"error": {"class": "GenericError", "desc": "NBD server already running"}} exports available: 0 -{"execute":"nbd-server-add", "arguments":{"device":"n", "bitmap":"b"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n", "bitmap":"b"}} {"return": {}} -{"execute":"nbd-server-add", "arguments":{"device":"nosuch"}} +{"execute":"nbd-server-add", + "arguments":{"device":"nosuch"}} {"error": {"class": "GenericError", "desc": "Cannot find device=nosuch nor node_name=nosuch"}} -{"execute":"nbd-server-add", "arguments":{"device":"n"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n"}} {"error": {"class": "GenericError", "desc": "Block export id 'n' is already in use"}} -{"execute":"nbd-server-add", "arguments":{"device":"n", "name":"n2", "bitmap":"b2"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n", "name":"n2", + "bitmap":"b2"}} {"error": {"class": "GenericError", "desc": "Enabled bitmap 'b2' incompatible with readonly export"}} -{"execute":"nbd-server-add", "arguments":{"device":"n", "name":"n2", "bitmap":"b3"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n", "name":"n2", + "bitmap":"b3"}} {"error": {"class": "GenericError", "desc": "Bitmap 'b3' is not found"}} -{"execute":"nbd-server-add", "arguments":{"device":"n", "name":"n2", "writable":true, "description":"some text", "bitmap":"b2"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n", "name":"n2", "writable":true, + "description":"some text", "bitmap":"b2"}} {"return": {}} exports available: 2 export: 'n' @@ -99,12 +116,15 @@ read 2097152/2097152 bytes at offset 2097152 === End qemu NBD server === -{"execute":"nbd-server-remove", "arguments":{"name":"n"}} +{"execute":"nbd-server-remove", + "arguments":{"name":"n"}} {"return": {}} -{"execute":"nbd-server-remove", "arguments":{"name":"n2"}} +{"execute":"nbd-server-remove", + "arguments":{"name":"n2"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "n"}} {"return": {}} -{"execute":"nbd-server-remove", "arguments":{"name":"n2"}} +{"execute":"nbd-server-remove", + "arguments":{"name":"n2"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "n2"}} {"error": {"class": "GenericError", "desc": "Export 'n2' is not found"}} {"execute":"nbd-server-stop"} @@ -114,26 +134,41 @@ read 2097152/2097152 bytes at offset 2097152 === Set up NBD with iothread access === -{"execute":"x-blockdev-set-iothread", "arguments":{"node-name":"n", "iothread":"io0"}} +{"execute":"x-blockdev-set-iothread", + "arguments":{"node-name":"n", "iothread":"io0"}} {"return": {}} -{"execute":"nbd-server-add", "arguments":{"device":"n"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n"}} {"error": {"class": "GenericError", "desc": "NBD server not running"}} -{"execute":"nbd-server-start", "arguments":{"addr":{"type":"unix", "data":{"path":"SOCK_DIR/nbd"}}}} +{"execute":"nbd-server-start", + "arguments":{"addr":{"type":"unix", + "data":{"path":"SOCK_DIR/nbd"}}}} {"return": {}} -{"execute":"nbd-server-start", "arguments":{"addr":{"type":"unix", "data":{"path":"SOCK_DIR/nbd1"}}}} +{"execute":"nbd-server-start", + "arguments":{"addr":{"type":"unix", + "data":{"path":"SOCK_DIR/nbd1"}}}} {"error": {"class": "GenericError", "desc": "NBD server already running"}} exports available: 0 -{"execute":"nbd-server-add", "arguments":{"device":"n", "bitmap":"b"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n", "bitmap":"b"}} {"return": {}} -{"execute":"nbd-server-add", "arguments":{"device":"nosuch"}} +{"execute":"nbd-server-add", + "arguments":{"device":"nosuch"}} {"error": {"class": "GenericError", "desc": "Cannot find device=nosuch nor node_name=nosuch"}} -{"execute":"nbd-server-add", "arguments":{"device":"n"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n"}} {"error": {"class": "GenericError", "desc": "Block export id 'n' is already in use"}} -{"execute":"nbd-server-add", "arguments":{"device":"n", "name":"n2", "bitmap":"b2"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n", "name":"n2", + "bitmap":"b2"}} {"error": {"class": "GenericError", "desc": "Enabled bitmap 'b2' incompatible with readonly export"}} -{"execute":"nbd-server-add", "arguments":{"device":"n", "name":"n2", "bitmap":"b3"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n", "name":"n2", + "bitmap":"b3"}} {"error": {"class": "GenericError", "desc": "Bitmap 'b3' is not found"}} -{"execute":"nbd-server-add", "arguments":{"device":"n", "name":"n2", "writable":true, "description":"some text", "bitmap":"b2"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n", "name":"n2", "writable":true, + "description":"some text", "bitmap":"b2"}} {"return": {}} exports available: 2 export: 'n' @@ -182,12 +217,15 @@ read 2097152/2097152 bytes at offset 2097152 === End qemu NBD server === -{"execute":"nbd-server-remove", "arguments":{"name":"n"}} +{"execute":"nbd-server-remove", + "arguments":{"name":"n"}} {"return": {}} -{"execute":"nbd-server-remove", "arguments":{"name":"n2"}} +{"execute":"nbd-server-remove", + "arguments":{"name":"n2"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "n"}} {"return": {}} -{"execute":"nbd-server-remove", "arguments":{"name":"n2"}} +{"execute":"nbd-server-remove", + "arguments":{"name":"n2"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "n2"}} {"error": {"class": "GenericError", "desc": "Export 'n2' is not found"}} {"execute":"nbd-server-stop"} -- cgit v1.2.3