From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id dqz7GOu+qGLmJwIAWB0awg (envelope-from ) for ; Tue, 14 Jun 2022 13:01:31 -0400 Received: by simark.ca (Postfix, from userid 112) id 51C8F1E224; Tue, 14 Jun 2022 13:01:31 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=HN4qMVET; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id EF6F31E143 for ; Tue, 14 Jun 2022 13:01:29 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3F449385C319 for ; Tue, 14 Jun 2022 17:01:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F449385C319 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1655226088; bh=8+K+CMWjJBj3to+HnoRpJ+ElhSFaS6bZgenywCsozHA=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=HN4qMVETJFAIMOjYF4ZzUpUelZjBcOv2iiKcxIK6JdP7QSuFgk7u/dHclb64Q+2IC 8wUW/yAcPk2t2VHhmfKWmuVbLSyX3CJm4ZorHfHAxWB0e5BRaY2MvuUP6yZkW/hX8+ NhVS3NvsKEo0W6hmmZRahmC5PsuSI6YAkZnH8czI= 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) 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-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: , From: Andrew Burgess via Gdb-patches Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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" \