From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoTN8-0004dS-DP for qemu-devel@nongnu.org; Wed, 12 Nov 2014 03:33:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XoTN2-0003c1-8s for qemu-devel@nongnu.org; Wed, 12 Nov 2014 03:33:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60863) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoTN2-0003bo-0P for qemu-devel@nongnu.org; Wed, 12 Nov 2014 03:33:44 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAC8Xh44004755 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 12 Nov 2014 03:33:43 -0500 Message-ID: <54631B64.5080704@redhat.com> Date: Wed, 12 Nov 2014 09:33:40 +0100 From: Max Reitz MIME-Version: 1.0 References: <1415712873-29274-1-git-send-email-mreitz@redhat.com> <1415712873-29274-3-git-send-email-mreitz@redhat.com> <5462E67E.7000607@redhat.com> In-Reply-To: <5462E67E.7000607@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/3] iotests: _filter_qmp for pretty JSON output List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , Markus Armbruster , Stefan Hajnoczi On 2014-11-12 at 05:47, Eric Blake wrote: > On 11/11/2014 06:34 AM, Max Reitz wrote: >> _filter_qmp should be able to correctly filter out the QMP version >> object for pretty JSON output. >> >> Signed-off-by: Max Reitz >> --- >> tests/qemu-iotests/common.filter | 16 +++++++++++++++- >> 1 file changed, 15 insertions(+), 1 deletion(-) >> >> diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter >> index 3acdb30..e24dab4 100644 >> --- a/tests/qemu-iotests/common.filter >> +++ b/tests/qemu-iotests/common.filter >> @@ -165,9 +165,23 @@ _filter_qemu() >> # replace problematic QMP output like timestamps >> _filter_qmp() >> { >> + discard=0 >> + >> _filter_win32 | \ >> sed -e 's#\("\(micro\)\?seconds": \)[0-9]\+#\1 TIMESTAMP#g' \ >> - -e 's#^{"QMP":.*}$#QMP_VERSION#' >> + -e 's#^{"QMP":.*}$#QMP_VERSION#' \ >> + -e 's#\\#\\\\#g' | \ >> + while IFS='' read line; do >> + if [[ $line == ' "QMP": {' ]]; then > Good that this is a /bin/bash script and not /bin/sh :) Ah, right, yes, I just copied the code I had written for filtering out the image-specific information from the qemu-img info output. > But - is it really worth doing this in shell? Why not just do it in sed? Because I don't know sed well enough. ;-) > sed -e ... \ > -e 's#\\#\\\\#g' \ > -e '/ "QMP": {/,/ }/ c\' \ > -e ' QMP_VERSION' Will do, thanks. Max