From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id NFYvK5/Um2E5BAAAWB0awg (envelope-from ) for ; Mon, 22 Nov 2021 12:34:23 -0500 Received: by simark.ca (Postfix, from userid 112) id 9F80C1F0CE; Mon, 22 Nov 2021 12:34:23 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.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 BF5AB1ECEB for ; Mon, 22 Nov 2021 12:34:22 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 36971385801C for ; Mon, 22 Nov 2021 17:34:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 36971385801C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1637602462; bh=QdRkDGIuN/yRSp+EOhcAGDXmWkXkuROPYBOfg3YTGyg=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=FZ4KMKPDKcRpsVisxkAjuq9aI1UYLk3ROffpMqwu9Z1GQpbsmmewQm+61uo0punbM h+/TkBuBZqpvOTfx77V+eQDsWdeef1r9rEnXOg96XouDTnoTasdn9+lsDincWnk+J1 leG5jjE7yaYvlnAvbxsH6hO1RehmeLUwaG7joqxU= Received: from lndn.lancelotsix.com (vps-42846194.vps.ovh.net [IPv6:2001:41d0:801:2000::2400]) by sourceware.org (Postfix) with ESMTPS id F07AF3858406 for ; Mon, 22 Nov 2021 17:34:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F07AF3858406 Received: from Plymouth (unknown [IPv6:2a02:390:9086:0:161b:48b:4db4:7b9a]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id AC6F080D5D; Mon, 22 Nov 2021 17:34:00 +0000 (UTC) Date: Mon, 22 Nov 2021 17:33:57 +0000 To: Pedro Alves Subject: Re: [PATCH 03/29] gdb/testsuite: Remove duplicates from gdb.base/interp.exp Message-ID: <20211122173357.iyzk2puf7uxcczie@Plymouth> References: <20211121175636.779325-1-lsix@lancelotsix.com> <20211121175636.779325-4-lsix@lancelotsix.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ym3j2bzkiusl2okb" Content-Disposition: inline In-Reply-To: X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Mon, 22 Nov 2021 17:34:00 +0000 (UTC) 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: Lancelot SIX via Gdb-patches Reply-To: Lancelot SIX Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" --ym3j2bzkiusl2okb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Nov 22, 2021 at 02:13:59PM +0000, Pedro Alves wrote: > On 2021-11-21 17:56, Lancelot SIX via Gdb-patches wrote: > > # Regression test for crash when an exception occurs in mi_parse. > > -gdb_test_multiple "interpreter-exec mi \"-break-insert --thread a\"" \ > > - "regression test for mi_parse crash" { > > +set cmd "interpreter-exec mi \"-break-insert --thread a\"" > > +gdb_test_multiple $cmd "regression test for mi_parse crash" { > > This "regression test for mi_parse crash" message is used if this > gdb_test_multiple detects an internal error, a timeout, etc. > > > -re ".error,msg=.Invalid value for the '--thread' option.\r\n$gdb_prompt " { > > pass "$cmd" > > ... while here we use $cmd. > > This means that this test can have its result oscillate like this: > > -FAIL: regression test for mi_parse crash" > +PASS: interpreter-exec mi "-break-insert --thread a" > ... > +PASS: interpreter-exec mi "-break-insert --thread a" > -FAIL: regression test for mi_parse crash" > > > The "modern" pattern would be to not have a $cmd variable at all, pass an empty > string as second argument to gdb_test_multiple, and then passing $gdb_test_name > to "pass". Like: > > gdb_test_multiple "interpreter-exec mi \"-break-insert --thread a\"" "" { > -re .... { > pass $gdb_test_multiple > } > } > > > Though simplest is to pass $cmd as second argument too like other > gdb_test_multiple invocations in the file: > > gdb_test_multiple $cmd $cmd { > ... > > > > Could you take care of this while at it? > > Pedro Alves Hi, Thanks for the inputs. I have updated the patch as follows. This could maybe be split into two independent patches (one to fix the DUPLICATE, which is a one-liner, and to refactor the various uses of gdb_test_multiple), but I stayed with one which does the fix and enforces consistency across the file. Lancelot. --- gdb/testsuite: Remove duplicates from gdb.base/interp.exp When running the testsuite I have: Running .../gdb/testsuite/gdb.base/interp.exp ... DUPLICATE: gdb.base/interp.exp: interpreter-exec mi "-var-update *" This is due to the fact that multiple successive instances of gdb_test_multiple use 'pass $cmd', but one of them forgets to reset $cmd to a new test name. Fix by using 'pass $gdb_test_name', given that the gdb_test_name is set by gdb_test_multiple. While fixing this, this patch refactors all occurrences of the following pattern: set cmd foo gdb_test_multiple $cmd $cmd { -re ... { pass $cmd } } into gdb_test_multiple foo "" { -re ... { pass $gdb_test_name } } This makes this test file coherent in its use of $gdb_test_name. Tested on x86_64-linux. --- gdb/testsuite/gdb.base/interp.exp | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/gdb/testsuite/gdb.base/interp.exp b/gdb/testsuite/gdb.base/interp.exp index fc95ee113c2..1f2bde250fc 100644 --- a/gdb/testsuite/gdb.base/interp.exp +++ b/gdb/testsuite/gdb.base/interp.exp @@ -22,10 +22,9 @@ if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile {debug}] } { } # Do not use gdb_test for this test, since it has two prompts. -set cmd "interpreter-exec mi \"-var-update *\"" -gdb_test_multiple $cmd $cmd { +gdb_test_multiple "interpreter-exec mi \"-var-update *\"" "" { -re "\\^done,changelist=\\\[\\\]\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } } @@ -37,47 +36,43 @@ gdb_test "interpreter-exec console \"show version\"" "GNU gdb .*" gdb_test_multiple "interpreter-exec mi \"-break-insert --thread a\"" \ "regression test for mi_parse crash" { -re ".error,msg=.Invalid value for the '--thread' option.\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } } } } -set cmd "interpreter-exec mi \"-stack-info-frame\"" -gdb_test_multiple $cmd $cmd { +gdb_test_multiple "interpreter-exec mi \"-stack-info-frame\"" "" { -re ".error,msg=.No registers\..\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } } } } -set cmd "interpreter-exec mi1 \"-break-insert main\"" -gdb_test_multiple $cmd $cmd { +gdb_test_multiple "interpreter-exec mi1 \"-break-insert main\"" "" { -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } } } } -set cmd "interpreter-exec mi2 \"-break-insert main\"" -gdb_test_multiple $cmd $cmd { +gdb_test_multiple "interpreter-exec mi2 \"-break-insert main\"" "" { -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } } } } -set cmd "interpreter-exec mi3 \"-break-insert main\"" -gdb_test_multiple $cmd $cmd { +gdb_test_multiple "interpreter-exec mi3 \"-break-insert main\"" "" { -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } } -- 2.33.1 --ym3j2bzkiusl2okb Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v2-0001-gdb-testsuite-Remove-duplicates-from-gdb.base-int.patch" >From 318524ca1ac8fe3eeb2555f59f0b15fe88edcd74 Mon Sep 17 00:00:00 2001 From: Lancelot SIX Date: Fri, 19 Nov 2021 19:55:05 +0000 Subject: [PATCH v2] gdb/testsuite: Remove duplicates from gdb.base/interp.exp When running the testsuite I have: Running .../gdb/testsuite/gdb.base/interp.exp ... DUPLICATE: gdb.base/interp.exp: interpreter-exec mi "-var-update *" This is due to the fact that multiple successive instances of gdb_test_multiple use 'pass $cmd', but one of them forgets to reset $cmd to a new test name. Fix by using 'pass $gdb_test_name', given that the gdb_test_name is set by gdb_test_multiple. While fixing this, this patch refactors all occurrences of the following pattern: set cmd foo gdb_test_multiple $cmd $cmd { -re ... { pass $cmd } } into gdb_test_multiple foo "" { -re ... { pass $gdb_test_name } } This makes this test file coherent in its use of $gdb_test_name. Tested on x86_64-linux. --- gdb/testsuite/gdb.base/interp.exp | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/gdb/testsuite/gdb.base/interp.exp b/gdb/testsuite/gdb.base/interp.exp index fc95ee113c2..1f2bde250fc 100644 --- a/gdb/testsuite/gdb.base/interp.exp +++ b/gdb/testsuite/gdb.base/interp.exp @@ -22,10 +22,9 @@ if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile {debug}] } { } # Do not use gdb_test for this test, since it has two prompts. -set cmd "interpreter-exec mi \"-var-update *\"" -gdb_test_multiple $cmd $cmd { +gdb_test_multiple "interpreter-exec mi \"-var-update *\"" "" { -re "\\^done,changelist=\\\[\\\]\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } } @@ -37,47 +36,43 @@ gdb_test "interpreter-exec console \"show version\"" "GNU gdb .*" gdb_test_multiple "interpreter-exec mi \"-break-insert --thread a\"" \ "regression test for mi_parse crash" { -re ".error,msg=.Invalid value for the '--thread' option.\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } } } } -set cmd "interpreter-exec mi \"-stack-info-frame\"" -gdb_test_multiple $cmd $cmd { +gdb_test_multiple "interpreter-exec mi \"-stack-info-frame\"" "" { -re ".error,msg=.No registers\..\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } } } } -set cmd "interpreter-exec mi1 \"-break-insert main\"" -gdb_test_multiple $cmd $cmd { +gdb_test_multiple "interpreter-exec mi1 \"-break-insert main\"" "" { -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } } } } -set cmd "interpreter-exec mi2 \"-break-insert main\"" -gdb_test_multiple $cmd $cmd { +gdb_test_multiple "interpreter-exec mi2 \"-break-insert main\"" "" { -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } } } } -set cmd "interpreter-exec mi3 \"-break-insert main\"" -gdb_test_multiple $cmd $cmd { +gdb_test_multiple "interpreter-exec mi3 \"-break-insert main\"" "" { -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } } -- 2.33.1 --ym3j2bzkiusl2okb--