From nobody Tue Feb 10 04:29:36 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506342633831702.4782056279643; Mon, 25 Sep 2017 05:30:33 -0700 (PDT) Received: from localhost ([::1]:42264 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwSWp-0005AA-0u for importer@patchew.org; Mon, 25 Sep 2017 08:30:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwSUs-0003eO-4Y for qemu-devel@nongnu.org; Mon, 25 Sep 2017 08:28:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwSUm-000650-Gy for qemu-devel@nongnu.org; Mon, 25 Sep 2017 08:28:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45324) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dwSUj-00063R-TB; Mon, 25 Sep 2017 08:28:18 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D5269C0587DE; Mon, 25 Sep 2017 12:28:16 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-119.ams2.redhat.com [10.36.116.119]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9AF2A70A10; Mon, 25 Sep 2017 12:28:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D5269C0587DE Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=kwolf@redhat.com From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 25 Sep 2017 14:28:06 +0200 Message-Id: <20170925122808.14561-4-kwolf@redhat.com> In-Reply-To: <20170925122808.14561-1-kwolf@redhat.com> References: <20170925122808.14561-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 25 Sep 2017 12:28:16 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/5] qemu-iotests: Allow QMP pretty printing in common.qemu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Eric Blake --- 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 7645f1dc72..92739a1eac 100644 --- a/tests/qemu-iotests/common.qemu +++ b/tests/qemu-iotests/common.qemu @@ -55,13 +55,13 @@ function _timed_wait_for() shift =20 QEMU_STATUS[$h]=3D0 - while read -t ${QEMU_COMM_TIMEOUT} resp <&${QEMU_OUT[$h]} + while IFS=3D 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 +129,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 s= tderr. # If this variable is empty, stderr will be redirected to st= dout. # Returns: @@ -145,7 +146,11 @@ function _launch_qemu() comm=3D"-monitor stdio" else local qemu_comm_method=3D"qmp" - comm=3D"-monitor none -qmp stdio" + if [ "$qmp_pretty" =3D "y" ]; then + comm=3D"-monitor none -qmp-pretty stdio" + else + comm=3D"-monitor none -qmp stdio" + fi fi =20 fifo_out=3D${QEMU_FIFO_OUT}_${_QEMU_HANDLE} @@ -192,6 +197,9 @@ function _launch_qemu() then # Don't print response, since it has version information in it silent=3Dyes _timed_wait_for ${_QEMU_HANDLE} "capabilities" + if [ "$qmp_pretty" =3D "y" ]; then + silent=3Dyes _timed_wait_for ${_QEMU_HANDLE} "^}" + fi fi QEMU_HANDLE=3D${_QEMU_HANDLE} let _QEMU_HANDLE++ --=20 2.13.5