public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/testsuite] Fix silent fail in gdb.server/connect-with-no-symbol-file.exp
@ 2022-10-08  8:47 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2022-10-08  8:47 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=db95282ce93b6453bc533ea1dbe1637213daf59b

commit db95282ce93b6453bc533ea1dbe1637213daf59b
Author: Tom de Vries <tdevries@suse.de>
Date:   Sat Oct 8 10:47:47 2022 +0200

    [gdb/testsuite] Fix silent fail in gdb.server/connect-with-no-symbol-file.exp
    
    With native and target boards native-gdbserver, remote-gdbserver-on-localhost and
    remote-stdio-gdbserver I have for gdb.server/connect-with-no-symbol-file.exp:
    ...
     # of expected passes            8
    ...
    but with native-extended-gdbserver I have instead:
    ...
     # of expected passes            8
     # of unexpected failures        4
    ...
    
    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=: \
      action=permission: connection to GDBserver succeeded
    ...
    and are due to the fact that the actual gdb output doesn't match the regexp:
    ...
        gdb_test "detach" \
           ".*Detaching from program: , process.*Ending remote debugging.*" \
           "connection to GDBserver succeeded"
    ...
    
    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 consequence
    that the FAIL is silent.
    
    Fix:
    - the regexp by making it less strict
    - the silent fail by rewriting into a gdb_test_multiple, and adding an
      explicit fail clause.
    
    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 } {
 
     # Check if GDB succeeded connecting to GDBserver by attempting to detach
     # 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"
 }
 
 # Make sure we have the original symbol file in a safe place to copy from.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-08  8:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-08  8:47 [binutils-gdb] [gdb/testsuite] Fix silent fail in gdb.server/connect-with-no-symbol-file.exp Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).