From: Andrew Burgess <aburgess@redhat.com>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/testsuite] Handle unordered dict in gdb.python/py-mi-cmd.exp
Date: Tue, 14 Jun 2022 18:01:01 +0100 [thread overview]
Message-ID: <874k0ndvsi.fsf@redhat.com> (raw)
In-Reply-To: <20220613110532.GA27620@delia.home>
Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes:
> Hi,
>
> When running test-case gdb.python/py-mi-cmd.exp on openSUSE Leap 42.3 with
> python 3.4, I occasionally run into:
> ...
> Expecting: ^(-pycmd dct[^M
> ]+)?(\^done,result={hello="world",times="42"}[^M
> ]+[(]gdb[)] ^M
> [ ]*)
> -pycmd dct^M
> ^done,result={times="42",hello="world"}^M
> (gdb) ^M
> FAIL: gdb.python/py-mi-cmd.exp: -pycmd dct (unexpected output)
> ...
>
> The problem is that the data type used here in py-mi-cmd.py:
> ...
> elif argv[0] == "dct":
> return {"result": {"hello": "world", "times": 42}}
> ...
> is a dictionary, and only starting version 3.6 are dictionaries insertion
> ordered, so using PyDict_Next in serialize_mi_result doesn't guarantee a
> fixed order.
>
> Fix this by allowing the alternative order.
>
> Tested on x86_64-linux.
>
> Any comments?
LGTM.
Thanks,
Andrew
>
> Thanks,
> - Tom
>
> [gdb/testsuite] Handle unordered dict in gdb.python/py-mi-cmd.exp
>
> ---
> gdb/testsuite/gdb.python/py-mi-cmd.exp | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/testsuite/gdb.python/py-mi-cmd.exp b/gdb/testsuite/gdb.python/py-mi-cmd.exp
> index d372518a031..733686098f8 100644
> --- a/gdb/testsuite/gdb.python/py-mi-cmd.exp
> +++ b/gdb/testsuite/gdb.python/py-mi-cmd.exp
> @@ -54,8 +54,10 @@ mi_gdb_test "-pycmd ary" \
> "\\^done,result=\\\[\"Hello\",\"42\"\\\]" \
> "-pycmd ary"
>
> +set re_order1 "\\^done,result={hello=\"world\",times=\"42\"}"
> +set re_order2 "\\^done,result={times=\"42\",hello=\"world\"}"
> mi_gdb_test "-pycmd dct" \
> - "\\^done,result={hello=\"world\",times=\"42\"}" \
> + "($re_order1|$re_order2)" \
> "-pycmd dct"
>
> mi_gdb_test "-pycmd bk1" \
prev parent reply other threads:[~2022-06-14 17:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-13 11:05 Tom de Vries
2022-06-14 17:01 ` Andrew Burgess [this message]
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=874k0ndvsi.fsf@redhat.com \
--to=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).