From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id B5AD2395251F for ; Sat, 8 Oct 2022 08:48:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B5AD2395251F Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id EE0BD218A2 for ; Sat, 8 Oct 2022 08:48:18 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id DA4501331A for ; Sat, 8 Oct 2022 08:48:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id TZ0SNFI5QWPoYAAAMHmgww (envelope-from ) for ; Sat, 08 Oct 2022 08:48:18 +0000 Date: Sat, 8 Oct 2022 10:48:17 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix silent fail in gdb.server/connect-with-no-symbol-file.exp Message-ID: <20221008084815.GA27577@delia.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Sat, 08 Oct 2022 08:48:21 -0000 Hi, 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. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix silent fail in gdb.server/connect-with-no-symbol-file.exp --- 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.