summaryrefslogtreecommitdiffstats
path: root/tests/qemu-iotests/common.qemu
diff options
context:
space:
mode:
authorPeter Maydell2017-10-06 18:43:02 +0200
committerPeter Maydell2017-10-06 18:43:02 +0200
commit530049bc1dcc24c1178a29d99ca08b6dd08413e0 (patch)
treec50588c08260188244b194556b23d8ad19ca0921 /tests/qemu-iotests/common.qemu
parentMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20171006'... (diff)
parentMerge remote-tracking branch 'mreitz/tags/pull-block-2017-10-06' into queue-b... (diff)
downloadqemu-530049bc1dcc24c1178a29d99ca08b6dd08413e0.tar.gz
qemu-530049bc1dcc24c1178a29d99ca08b6dd08413e0.tar.xz
qemu-530049bc1dcc24c1178a29d99ca08b6dd08413e0.zip
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Block layer patches # gpg: Signature made Fri 06 Oct 2017 16:52:59 BST # gpg: using RSA key 0x7F09B272C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * remotes/kevin/tags/for-upstream: (54 commits) block/mirror: check backing in bdrv_mirror_top_flush qcow2: truncate the tail of the image file after shrinking the image qcow2: fix return error code in qcow2_truncate() iotests: Fix 195 if IMGFMT is part of TEST_DIR block/mirror: check backing in bdrv_mirror_top_refresh_filename block: support passthrough of BDRV_REQ_FUA in crypto driver block: convert qcrypto_block_encrypt|decrypt to take bytes offset block: convert crypto driver to bdrv_co_preadv|pwritev block: fix data type casting for crypto payload offset crypto: expose encryption sector size in APIs block: use 1 MB bounce buffers for crypto instead of 16KB iotests: Add test 197 for covering copy-on-read block: Perform copy-on-read in loop block: Add blkdebug hook for copy-on-read iotests: Restore stty settings on completion block: Uniform handling of 0-length bdrv_get_block_status() qemu-io: Add -C for opening with copy-on-read commit: Remove overlay_bs qemu-iotests: Test commit block job where top has two parents qemu-iotests: Allow QMP pretty printing in common.qemu ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/qemu-iotests/common.qemu')
-rw-r--r--tests/qemu-iotests/common.qemu15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu
index 7645f1dc72..7b3052dc79 100644
--- a/tests/qemu-iotests/common.qemu
+++ b/tests/qemu-iotests/common.qemu
@@ -31,6 +31,7 @@ QEMU_FIFO_IN="${QEMU_TEST_DIR}/qmp-in-$$"
QEMU_FIFO_OUT="${QEMU_TEST_DIR}/qmp-out-$$"
QEMU_HANDLE=0
+export _QEMU_HANDLE=0
# If bash version is >= 4.1, these will be overwritten and dynamic
# file descriptor values assigned.
@@ -55,13 +56,13 @@ function _timed_wait_for()
shift
QEMU_STATUS[$h]=0
- while read -t ${QEMU_COMM_TIMEOUT} resp <&${QEMU_OUT[$h]}
+ while IFS= read -t ${QEMU_COMM_TIMEOUT} resp <&${QEMU_OUT[$h]}
do
if [ -z "${silent}" ]; then
echo "${resp}" | _filter_testdir | _filter_qemu \
| _filter_qemu_io | _filter_qmp | _filter_hmp
fi
- grep -q "${*}" < <(echo ${resp})
+ grep -q "${*}" < <(echo "${resp}")
if [ $? -eq 0 ]; then
return
fi
@@ -129,6 +130,7 @@ function _send_qemu_cmd()
# $qemu_comm_method: set this variable to 'monitor' (case insensitive)
# to use the QEMU HMP monitor for communication.
# Otherwise, the default of QMP is used.
+# $qmp_pretty: Set this variable to 'y' to enable QMP pretty printing.
# $keep_stderr: Set this variable to 'y' to keep QEMU's stderr output on stderr.
# If this variable is empty, stderr will be redirected to stdout.
# Returns:
@@ -145,7 +147,11 @@ function _launch_qemu()
comm="-monitor stdio"
else
local qemu_comm_method="qmp"
- comm="-monitor none -qmp stdio"
+ if [ "$qmp_pretty" = "y" ]; then
+ comm="-monitor none -qmp-pretty stdio"
+ else
+ comm="-monitor none -qmp stdio"
+ fi
fi
fifo_out=${QEMU_FIFO_OUT}_${_QEMU_HANDLE}
@@ -192,6 +198,9 @@ function _launch_qemu()
then
# Don't print response, since it has version information in it
silent=yes _timed_wait_for ${_QEMU_HANDLE} "capabilities"
+ if [ "$qmp_pretty" = "y" ]; then
+ silent=yes _timed_wait_for ${_QEMU_HANDLE} "^}"
+ fi
fi
QEMU_HANDLE=${_QEMU_HANDLE}
let _QEMU_HANDLE++