From: Max Reitz <mreitz@redhat.com>
To: Sascha Silbe <silbe@linux.vnet.ibm.com>,
qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org
Cc: Tu Bo <tubo@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] qemu-iotests: add _filter_qmp_events() for filtering out QMP events
Date: Wed, 10 Feb 2016 17:43:54 +0100 [thread overview]
Message-ID: <56BB68CA.6080508@redhat.com> (raw)
In-Reply-To: <1455024190-105823-2-git-send-email-silbe@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1786 bytes --]
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.
>
> Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
> ---
> tests/qemu-iotests/common.filter | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.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'
> }
>
> +# 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()
> {
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-02-10 16:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-09 13:23 [Qemu-devel] [PATCH 0/2] qemu-iotests: fix 067 on s390x Sascha Silbe
2016-02-09 13:23 ` [Qemu-devel] [PATCH 1/2] qemu-iotests: add _filter_qmp_events() for filtering out QMP events Sascha Silbe
2016-02-10 16:43 ` Max Reitz [this message]
2016-02-10 18:52 ` Sascha Silbe
2016-02-10 22:14 ` Eric Blake
2016-02-11 16:54 ` Sascha Silbe
2016-02-09 13:23 ` [Qemu-devel] [PATCH 2/2] qemu-iotests: 067: ignore " Sascha Silbe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56BB68CA.6080508@redhat.com \
--to=mreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=silbe@linux.vnet.ibm.com \
--cc=tubo@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).