From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7833) id 200C03858C53; Thu, 14 Apr 2022 17:31:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 200C03858C53 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Lancelot SIX To: gdb-cvs@sourceware.org Subject: [binutils-gdb/gdb-12-branch] gdb/testsuite: Fix race in gdb.dwarf2/calling-convention.exp X-Act-Checkin: binutils-gdb X-Git-Author: Lancelot SIX X-Git-Refname: refs/heads/gdb-12-branch X-Git-Oldrev: db7127461e1598b9a86ab2c2a365ea0c28d38817 X-Git-Newrev: d0632031920eeb48e28664ab18e0402a93b9f224 Message-Id: <20220414173109.200C03858C53@sourceware.org> Date: Thu, 14 Apr 2022 17:31:09 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Apr 2022 17:31:09 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dd0632031920e= eb48e28664ab18e0402a93b9f224 commit d0632031920eeb48e28664ab18e0402a93b9f224 Author: Lancelot SIX Date: Thu Apr 14 18:21:04 2022 +0100 gdb/testsuite: Fix race in gdb.dwarf2/calling-convention.exp =20 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 : =20 make check-read1 TESTS=3D"gdb.dwarf2/calling-convention.exp" =20 The relevant part of the gdb.log file is: =20 return 35 Function 'foo' does not follow the target calling convention. If you continue, setting the return value will probably lead to unp= redictable behaviors. Make foo return now? (y or n) PASS: gdb.dwarf2/calling-convention.e= xp: return 35 n Not confirmed (gdb) FAIL: gdb.dwarf2/calling-convention.exp: finish =20 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. =20 Fix by using gdb_test to send the "n" answer and match the confirmation and consume all output to the prompt. =20 Also do minor adjustments to the main regex: - Remove the leading ".*" which is not required. - Ensure that the "?" from the question is properly escaped. =20 Tested on x86_64-gnu-linux, using =20 - make check TESTS=3D"gdb.dwarf2/calling-convention.exp" - make check-read1 TESTS=3D"gdb.dwarf2/calling-convention.exp" - make check-readmore TESTS=3D"gdb.dwarf2/calling-convention.exp" =20 Co-authored-by: Pedro Alves Change-Id: I42858b13db2cbd623c5c1739de65ad423e0c0938 Diff: --- 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/testsuit= e/gdb.dwarf2/calling-convention.exp index 0a11cb15c68..77107a42350 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" =20 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 unpredict= able behaviors.\r\nMake foo return now?.*\\(y or n\\) $" { - send_gdb "n\n" + -re "Function 'foo' does not follow the target calling convention.\r\n= If you continue, setting the return value will probably lead to unpredictab= le behaviors.\r\nMake foo return now\\? \\(y or n\\) $" { pass $gdb_test_name + gdb_test "n" "Not confirmed" "cancel return" } }