From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 09B64385043E for ; Mon, 13 Jun 2022 11:05:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 09B64385043E Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3FEB821D2D; Mon, 13 Jun 2022 11:05:35 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 28AB3134CF; Mon, 13 Jun 2022 11:05:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id tCPVCP8Zp2LYbgAAMHmgww (envelope-from ); Mon, 13 Jun 2022 11:05:35 +0000 Date: Mon, 13 Jun 2022 13:05:33 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH][gdb/testsuite] Handle unordered dict in gdb.python/py-mi-cmd.exp Message-ID: <20220613110532.GA27620@delia.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jun 2022 11:05:37 -0000 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? 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" \