From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 6E261385734C for ; Tue, 14 Jun 2022 17:01:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6E261385734C Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-564-HnmvPklrONmi9ZhQsOklTg-1; Tue, 14 Jun 2022 13:01:04 -0400 X-MC-Unique: HnmvPklrONmi9ZhQsOklTg-1 Received: by mail-wm1-f70.google.com with SMTP id n15-20020a05600c4f8f00b0039c3e76d646so5062863wmq.7 for ; Tue, 14 Jun 2022 10:01:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=8+K+CMWjJBj3to+HnoRpJ+ElhSFaS6bZgenywCsozHA=; b=ssSoZipsUc0NYDfHkn/iTQJNZEJL4LGPeVHGV6mNtgW+TMsaMDfY5p3DKOxRuYZgTc BfSEX2gCtnCgatpvFqMCfLhtwdcozjE+hLHry2dV9slu+lGZZ7lse2FTPj+xB0TbN9Sx 2PpEByP94fuo1bsxHA6HMC8naUoGwBYUEccBUJK2Elscki70imYW5EHLgJLh7PWgLMBv Cj9DPEML2HEz5aOvVxpBMksjRKcaH58FbPOaIZ5f0oZfdqjlgtxdZhyT2Uflkc2jPNyw pYCoZwgwGvIS69ENNw5ovEF5cMHpB0+XvlzkLl5RpqtBJ53cD/aEwRG2Qd8aijinXcVN uiuA== X-Gm-Message-State: AJIora9vWND20Qk2Kh9QFq4g31Ie2yCsrc9LTGvpFN/eoFDmU7KkhRJJ kCuY5kXULcRtSzvnihvSATym2k+GrnTHe19/cAPPt3B24RBnLCvxPZcaPGv8pBwRWuQ3QyW3vbA 3l4nFYIBjZ7G603uRgLugAQ== X-Received: by 2002:a05:6000:178d:b0:20f:e960:2f2 with SMTP id e13-20020a056000178d00b0020fe96002f2mr5892135wrg.569.1655226062680; Tue, 14 Jun 2022 10:01:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1urgF1UjnpKodK6jKFfUsLoLbo+aSGOvqAUKkN38Uh+/o4DhXOw81aoqi5jQ3NmyEDxwsTu5Q== X-Received: by 2002:a05:6000:178d:b0:20f:e960:2f2 with SMTP id e13-20020a056000178d00b0020fe96002f2mr5892110wrg.569.1655226062461; Tue, 14 Jun 2022 10:01:02 -0700 (PDT) Received: from localhost (host109-154-20-145.range109-154.btcentralplus.com. [109.154.20.145]) by smtp.gmail.com with ESMTPSA id q7-20020a056000136700b0020c6b78eb5asm12197442wrz.68.2022.06.14.10.01.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 10:01:02 -0700 (PDT) From: Andrew Burgess To: Tom de Vries , gdb-patches@sourceware.org Subject: Re: [PATCH][gdb/testsuite] Handle unordered dict in gdb.python/py-mi-cmd.exp In-Reply-To: <20220613110532.GA27620@delia.home> References: <20220613110532.GA27620@delia.home> Date: Tue, 14 Jun 2022 18:01:01 +0100 Message-ID: <874k0ndvsi.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, 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: Tue, 14 Jun 2022 17:01:10 -0000 Tom de Vries via Gdb-patches 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" \