[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 35/54] qemu-iotests: Allow QMP pretty printing in com
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 35/54] qemu-iotests: Allow QMP pretty printing in common.qemu |
Date: |
Fri, 6 Oct 2017 17:54:03 +0200 |
QMP responses to certain commands can become quite long, which doesn't
only make reading them hard, but also means that the maximum line length
in patch emails can be exceeded. Allow tests to switch to QMP pretty
printing, which results in more, but shorter lines.
We also need to make sure to keep indentation in the response for this
to work as expected.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
tests/qemu-iotests/common.qemu | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu
index 9f9aecc9df..7b3052dc79 100644
--- a/tests/qemu-iotests/common.qemu
+++ b/tests/qemu-iotests/common.qemu
@@ -56,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
@@ -130,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:
@@ -146,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}
@@ -193,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++
--
2.13.6
- [Qemu-devel] [PULL 24/54] qemu-iotests: get rid of AWK_PROG, (continued)
- [Qemu-devel] [PULL 24/54] qemu-iotests: get rid of AWK_PROG, Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 25/54] qemu-iotests: move "check" code out of common.rc, Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 26/54] qemu-iotests: cleanup and fix search for programs, Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 30/54] qemu-iotests: fix uninitialized variable, Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 27/54] qemu-iotests: limit non-_PROG-suffixed variables to common.rc, Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 29/54] qemu-iotests: disintegrate more parts of common.config, Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 31/54] qemu-iotests: get rid of $iam, Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 28/54] qemu-iotests: do not include common.rc in "check", Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 33/54] block: Introduce BdrvChildRole.update_filename, Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 39/54] block: Uniform handling of 0-length bdrv_get_block_status(), Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 35/54] qemu-iotests: Allow QMP pretty printing in common.qemu,
Kevin Wolf <=
- [Qemu-devel] [PULL 34/54] commit: Support multiple roots above top node, Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 32/54] qemu-iotests: merge "check" and "common", Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 38/54] qemu-io: Add -C for opening with copy-on-read, Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 37/54] commit: Remove overlay_bs, Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 40/54] iotests: Restore stty settings on completion, Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 46/54] block: fix data type casting for crypto payload offset, Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 45/54] crypto: expose encryption sector size in APIs, Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 41/54] block: Add blkdebug hook for copy-on-read, Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 42/54] block: Perform copy-on-read in loop, Kevin Wolf, 2017/10/06
- [Qemu-devel] [PULL 44/54] block: use 1 MB bounce buffers for crypto instead of 16KB, Kevin Wolf, 2017/10/06