From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTXs4-00080K-3K for qemu-devel@nongnu.org; Wed, 10 Feb 2016 11:44:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTXs2-0006l2-SE for qemu-devel@nongnu.org; Wed, 10 Feb 2016 11:44:04 -0500 References: <1455024190-105823-1-git-send-email-silbe@linux.vnet.ibm.com> <1455024190-105823-2-git-send-email-silbe@linux.vnet.ibm.com> From: Max Reitz Message-ID: <56BB68CA.6080508@redhat.com> Date: Wed, 10 Feb 2016 17:43:54 +0100 MIME-Version: 1.0 In-Reply-To: <1455024190-105823-2-git-send-email-silbe@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="11jcn30MexEB8N4EM6wHAgqSC8jFqupwU" Subject: Re: [Qemu-devel] [PATCH 1/2] qemu-iotests: add _filter_qmp_events() for filtering out QMP events List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sascha Silbe , qemu-devel@nongnu.org, Kevin Wolf , qemu-block@nongnu.org Cc: Tu Bo This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --11jcn30MexEB8N4EM6wHAgqSC8jFqupwU Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 09.02.2016 14:23, Sascha Silbe wrote: > The order of some QMP events may depend on the architecture being > tested. Add support for filtering out QMP events so we can use a > single reference output for all architecture when the test doesn't > care about the events. >=20 > Signed-off-by: Sascha Silbe > --- > tests/qemu-iotests/common.filter | 6 ++++++ > 1 file changed, 6 insertions(+) >=20 > diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/comm= on.filter > index 84b7434..b908aa2 100644 > --- a/tests/qemu-iotests/common.filter > +++ b/tests/qemu-iotests/common.filter > @@ -178,6 +178,12 @@ _filter_qmp() > -e ' QMP_VERSION' > } > =20 > +# remove QMP events from output > +_filter_qmp_events() > +{ > + sed -e '/^{\(.*, \)"event": ".*}$/ d' > +} There is a pretty good reason test 067 uses -qmp-pretty (as you yourself say, the lines get pretty long otherwise, and if we have any change within, the whole line needs to be changed). Using the following ugly piece of code here instead, we would still be able to use it: tr '\n' '\t' \ | sed -e 's/{\s*"timestamp":\s*{[^}]*},\s*"event":[^,}]*\(,\s*"data":\s*{[^}]*}\)\= ?\s*}\s*//g' \ | tr '\t' '\n' (I'm too lazy for multi-line sed, obviously; and this will break if the data contains any JSON objects in turn.) The correct way would be to actually parse the JSON (using perl, python or whatever) and remove all the top-level objects containing an "event" key, obviously... But that's probably too much. I'm not strictly against just dropping -qmp-pretty in 067, but there is a good reason it's there. Max > + > # replace driver-specific options in the "Formatting..." line > _filter_img_create() > { >=20 --11jcn30MexEB8N4EM6wHAgqSC8jFqupwU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJWu2jKAAoJEDuxQgLoOKyt8TMH/2Yafe9f2gUtxIzcjCiKJktT tMlnulzebaEF45K37eK9JaYPkGV+brZXaFWd4dB+xjbah+MFJvheure4/372BvOc ZV5IaNDFxdKhWdvtUHe/t0qZ29J/2/3kDBOEDU5gHxaNkeakt6K0F4ol2ziSb+DY wllGn7wdba6qHq60FEfdoydGVqiSc4uLRbz76CwNTLqxM//eAVbB842bhNXCViwW 9msmpHvHgxJMyIJlhrPqXt1tUIKhHPup7jvIszQaS+LxBAeMraAzVwwFrVgEyNWo hnArx7R6oWAvioWJzfTC6fQZiGkORuHw4HwBJD4ydJDT/ptx7a1xmAbH9dcRJ5U= =V6oF -----END PGP SIGNATURE----- --11jcn30MexEB8N4EM6wHAgqSC8jFqupwU--