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 095CD3858D3C for ; Wed, 30 Mar 2022 13:12:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 095CD3858D3C Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-20-Ev7fX44-PeCVVC4XPIjV3w-1; Wed, 30 Mar 2022 09:12:34 -0400 X-MC-Unique: Ev7fX44-PeCVVC4XPIjV3w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DE4051C068DD; Wed, 30 Mar 2022 13:12:33 +0000 (UTC) Received: from [10.97.116.51] (ovpn-116-51.gru2.redhat.com [10.97.116.51]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4413E40CFD02; Wed, 30 Mar 2022 13:12:31 +0000 (UTC) Message-ID: Date: Wed, 30 Mar 2022 10:12:28 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] gdb/testsuite: Fix race in gdb.dwarf2/calling-convention.exp To: Lancelot SIX , gdb-patches@sourceware.org Cc: lsix@lancelotsix.com References: <20220330125013.137768-1-lancelot.six@amd.com> From: Bruno Larsen In-Reply-To: <20220330125013.137768-1-lancelot.six@amd.com> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Wed, 30 Mar 2022 13:12:39 -0000 On 3/30/22 09:50, Lancelot SIX via Gdb-patches wrote: > Pedro Alves warned me that there is a race in > gdb.dwarf2/calling-convention.exp making the test sometimes fail on his > setup. This can be reliably reproduced using : > > make check-read1 TESTS="gdb.dwarf2/calling-convention.exp" > > The relevant part of the gdb.log file is: > > return 35 > Function 'foo' does not follow the target calling convention. > If you continue, setting the return value will probably lead to unpredictable behaviors. > Make foo return now? (y or n) PASS: gdb.dwarf2/calling-convention.exp: return 35 > n > Not confirmed > (gdb) FAIL: gdb.dwarf2/calling-convention.exp: finish > > The issue is that when doing the test for "return 35", the DejaGnu test > sends "n" (to tell GDB not to perform the return action) but never > consumes the "Not confirmed" acknowledgment sent by GDB. Later, when > trying to do the next test, DejaGnu tries to match the leftover output > from the "return" test. As this output is not expected, the test fails. > > Fix this by consuming the "Not confirmed\r\n$gdb_prompt " output. > > While at cleaning up this test, also improve the regex for the return > test: > - Remove the leading ".*" pattern. > - Replace the "$" (end of line marker) with "\$" because it does not > identify a TCL variable. > > Tested on x86_64-gnu-linux, using > > - make check TESTS="gdb.dwarf2/calling-convention.exp" > - make check-read1 TESTS="gdb.dwarf2/calling-convention.exp" > > Change-Id: I42858b13db2cbd623c5c1739de65ad423e0c0938 Thanks for looking at this! It had me quite confused. The change and explanation looks good to me, but I can't approve patches. > --- > gdb/testsuite/gdb.dwarf2/calling-convention.exp | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/gdb/testsuite/gdb.dwarf2/calling-convention.exp b/gdb/testsuite/gdb.dwarf2/calling-convention.exp > index 0a11cb15c68..7ea9ae7c768 100644 > --- a/gdb/testsuite/gdb.dwarf2/calling-convention.exp > +++ b/gdb/testsuite/gdb.dwarf2/calling-convention.exp > @@ -84,9 +84,9 @@ gdb_breakpoint "foo" > gdb_continue_to_breakpoint "foo" > > gdb_test_multiple "return 35" "" { > - -re ".*Function 'foo' does not follow the target calling convention.\r\nIf you continue, setting the return value will probably lead to unpredictable behaviors.\r\nMake foo return now?.*\\(y or n\\) $" { > - send_gdb "n\n" > + -re "Function 'foo' does not follow the target calling convention.\r\nIf you continue, setting the return value will probably lead to unpredictable behaviors.\r\nMake foo return now?.*\\(y or n\\) \$" { > pass $gdb_test_name > + gdb_test "n" "Not confirmed" "Cancel return" > } > } > > > base-commit: 5321c31bc78379a33f07dc7bef9256d05b942ad7 -- Cheers! Bruno Larsen