From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 9574B3949F34; Sat, 8 Oct 2022 08:47:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9574B3949F34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665218872; bh=SclX3wenB6O67nMjxSvy5YUvxEJDIt6fHS1YlOamj0c=; h=From:To:Subject:Date:From; b=LYArRa4/ENH4n4Ba+VCCWTheanNpBuMi+xQxxgk3Kxn7u9Rng7oYtZDWDZvKtpaCP 1k1cyzlLcNz67sGxv0xOVik6D2NPUZyJNGPI+XvU91rTTOHxYJbrspbtWZWha2CSbJ R4dkZEdcHILeKezItiJYFppDhP3aWGFuW9LdY7GE= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix silent fail in gdb.server/connect-with-no-symbol-file.exp X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 4cbfd0daabd68516651ee37a19d0e24ca4789ea3 X-Git-Newrev: db95282ce93b6453bc533ea1dbe1637213daf59b Message-Id: <20221008084752.9574B3949F34@sourceware.org> Date: Sat, 8 Oct 2022 08:47:52 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Ddb95282ce93b= 6453bc533ea1dbe1637213daf59b commit db95282ce93b6453bc533ea1dbe1637213daf59b Author: Tom de Vries Date: Sat Oct 8 10:47:47 2022 +0200 [gdb/testsuite] Fix silent fail in gdb.server/connect-with-no-symbol-fi= le.exp =20 With native and target boards native-gdbserver, remote-gdbserver-on-loc= alhost and remote-stdio-gdbserver I have for gdb.server/connect-with-no-symbol-fil= e.exp: ... # of expected passes 8 ... but with native-extended-gdbserver I have instead: ... # of expected passes 8 # of unexpected failures 4 ... =20 The extra FAILs are of the form: ... (gdb) detach^M Detaching from pid process 28985^M [Inferior 1 (process 28985) detached]^M (gdb) FAIL: gdb.server/connect-with-no-symbol-file.exp: sysroot=3D: \ action=3Dpermission: connection to GDBserver succeeded ... and are due to the fact that the actual gdb output doesn't match the re= gexp: ... gdb_test "detach" \ ".*Detaching from program: , process.*Ending remote debugging.*"= \ "connection to GDBserver succeeded" ... =20 With native, the actual gdb output is: ... (gdb) detach^M Detaching from pid process 29657^M Ending remote debugging.^M [Inferior 1 (process 29657) detached]^M (gdb) Remote debugging from host ::1, port 51028^M ... and because the regexp doesn't match, it triggers an implicit clause for "Ending remote debugging" in gdb_test_multiple, which has the consequen= ce that the FAIL is silent. =20 Fix: - the regexp by making it less strict - the silent fail by rewriting into a gdb_test_multiple, and adding an explicit fail clause. =20 Tested on x86_64-linux, using native and aforementioned target boards. Diff: --- gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp | 16 ++++++++++++= +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp b/gdb= /testsuite/gdb.server/connect-with-no-symbol-file.exp index 6c480c8c0cf..d45e958a529 100644 --- a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp +++ b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp @@ -75,9 +75,19 @@ proc connect_no_symbol_file { sysroot action } { =20 # Check if GDB succeeded connecting to GDBserver by attempting to deta= ch # from the process. - gdb_test "detach" \ - ".*Detaching from program: , process.*Ending remote debugging.*" \ - "connection to GDBserver succeeded" + # Use an explicit fail clause to prevent the implicit clause matching + # "Ending remote debugging" from triggering, which would cause silent + # failure. + set ok 0 + gdb_test_multiple "detach" "" { + -re "\r\nDetaching from \[^\r\n\]*" { + set ok 1 + exp_continue + } + -re -wrap "" { + } + } + gdb_assert $ok "connection to GDBserver succeeded" } =20 # Make sure we have the original symbol file in a safe place to copy from.