From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoPqf-0001nl-Hw for qemu-devel@nongnu.org; Tue, 11 Nov 2014 23:48:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XoPqa-0004H3-En for qemu-devel@nongnu.org; Tue, 11 Nov 2014 23:48:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47651) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoPqa-0004Gy-6J for qemu-devel@nongnu.org; Tue, 11 Nov 2014 23:48:00 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAC4lx4i028583 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 11 Nov 2014 23:47:59 -0500 Message-ID: <5462E67E.7000607@redhat.com> Date: Tue, 11 Nov 2014 21:47:58 -0700 From: Eric Blake MIME-Version: 1.0 References: <1415712873-29274-1-git-send-email-mreitz@redhat.com> <1415712873-29274-3-git-send-email-mreitz@redhat.com> In-Reply-To: <1415712873-29274-3-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="aVlb3bxXgv8j35qAkuh0fOsIsPcaUlVvn" 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: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , Markus Armbruster , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --aVlb3bxXgv8j35qAkuh0fOsIsPcaUlVvn Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > Signed-off-by: Max Reitz > --- > tests/qemu-iotests/common.filter | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) >=20 > diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/comm= on.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=3D0 > + > _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=3D'' read line; do > + if [[ $line =3D=3D ' "QMP": {' ]]; then Good that this is a /bin/bash script and not /bin/sh :) But - is it really worth doing this in shell? Why not just do it in sed?= sed -e ... \ -e 's#\\#\\\\#g' \ -e '/ "QMP": {/,/ }/ c\' \ -e ' QMP_VERSION' --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --aVlb3bxXgv8j35qAkuh0fOsIsPcaUlVvn Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUYuZ+AAoJEKeha0olJ0NqgZMH/iJbfzFFL5J9p1dsjc278Osv srsx7uA52iAOm8QqwAIjq3vNNV1glSv3u6gk9STDnyny3gH5uOBqRIaOEzkxu3iX FtzIHjgYRxfypOmh3nFu++RXuvDK1l2C/FEPoWw/ZnUcRaGz4InK+BGmQm7To9Kh aVf1rad9OkgU6QXe14/cs1e1cnF/BJ3fpE4RMOMsThum+DknAV8O+2gxfDOK6Ms+ Cak9Qr8q3itBUqmOFZdsvaiDm1pxZCo6NAp1KM2FtnHkMTAwJJdCs6jjqMcILsCV +4DTJlswzB5gs7r9eSsPkmPzoTk925IycgCDDMplwMX0cN9jIR8gf1i7C0kBz50= =Wsho -----END PGP SIGNATURE----- --aVlb3bxXgv8j35qAkuh0fOsIsPcaUlVvn--