From: Eric Blake <eblake@redhat.com>
To: John Snow <jsnow@redhat.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] iotests/236: fix transaction kwarg order
Date: Wed, 30 Jan 2019 21:44:06 -0600 [thread overview]
Message-ID: <9fb6044c-1535-9580-e968-670ed253dcbc@redhat.com> (raw)
In-Reply-To: <20190131022648.14264-1-jsnow@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1558 bytes --]
On 1/30/19 8:26 PM, John Snow wrote:
> It's not enough to order the kwargs for consistent QMP log output,
> we must also sort any sub-dictionaries in lists that appear as values.
>
> Reported-by: Kevin Wolf <kwolf@redhat.com>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
> tests/qemu-iotests/236.out | 56 +++++++++++++++++------------------
> tests/qemu-iotests/iotests.py | 21 ++++++-------
> 2 files changed, 39 insertions(+), 38 deletions(-)
>
> +++ b/tests/qemu-iotests/iotests.py
> @@ -76,15 +76,16 @@ def qemu_img(*args):
> sys.stderr.write('qemu-img received signal %i: %s\n' % (-exitcode, ' '.join(qemu_img_args + list(args))))
> return exitcode
>
> -def ordered_kwargs(kwargs):
> - # kwargs prior to 3.6 are not ordered, so:
> - od = OrderedDict()
> - for k, v in sorted(kwargs.items()):
> - if isinstance(v, dict):
> - od[k] = ordered_kwargs(v)
> - else:
> - od[k] = v
> - return od
> +def ordered_qmp(qmsg):
> + # Dictionaries are not ordered prior to 3.6, therefore:
> + if isinstance(qmsg, list):
> + return [ordered_qmp(atom) for atom in qmsg]
> + if isinstance(qmsg, dict):
> + od = OrderedDict()
> + for k, v in sorted(qmsg.items()):
> + od[k] = ordered_qmp(v)
> + return od
> + return qmsg
>
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-01-31 3:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-31 2:26 [Qemu-devel] [PATCH] iotests/236: fix transaction kwarg order John Snow
2019-01-31 3:44 ` Eric Blake [this message]
2019-01-31 9:04 ` Kevin Wolf
2019-01-31 10:17 ` Vladimir Sementsov-Ogievskiy
2019-02-01 19:10 ` John Snow
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=9fb6044c-1535-9580-e968-670ed253dcbc@redhat.com \
--to=eblake@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).