public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH] [gdb/testsuite] Fix gdb.server/server-connect.exp for missing ipv6
Date: Tue, 19 Mar 2024 08:48:10 +0100	[thread overview]
Message-ID: <20240319074810.18541-1-tdevries@suse.de> (raw)

On a system without ipv6 support enabled, when running test-case
gdb.server/server-connect.exp, it takes about 4 minutes, and I get:
...
builtin_spawn gdbserver --once ::1:2347 server-connect^M
Can't open socket: Address family not supported by protocol.^M
Exiting^M
PASS: gdb.server/server-connect.exp: tcp6: start gdbserver
target remote tcp6:::1:2347^M
A program is being debugged already.  Kill it? (y or n) y^M
could not connect: Address family not supported by protocol.^M
(gdb) FAIL: gdb.server/server-connect.exp: tcp6: connect to gdbserver using tcp6:::1
...

Fix this by:
- recognizing the error message in gdbserver_start, and returning an empty list
  to signal unsupported, and
- handling the unsupported response in the test-case.

This brings testing time down to 2 seconds, and gets me:
...
UNSUPPORTED: gdb.server/server-connect.exp: tcp6: start gdbserver
UNSUPPORTED: gdb.server/server-connect.exp: tcp6-with-brackets: start gdbserver
UNSUPPORTED: gdb.server/server-connect.exp: udp6: start gdbserver
UNSUPPORTED: gdb.server/server-connect.exp: udp6-with-brackets: start gdbserver
...

Tested on aarch64-linux.

PR testsuite/31502
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31502
---
 gdb/testsuite/gdb.server/server-connect.exp | 3 +++
 gdb/testsuite/lib/gdbserver-support.exp     | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/gdb/testsuite/gdb.server/server-connect.exp b/gdb/testsuite/gdb.server/server-connect.exp
index dd81585a796..7617da66acd 100644
--- a/gdb/testsuite/gdb.server/server-connect.exp
+++ b/gdb/testsuite/gdb.server/server-connect.exp
@@ -88,6 +88,9 @@ save_vars { GDB_TEST_SOCKETHOST } {
 	    } else {
 		if { $gdbserver_should_fail } {
 		    fail "$test: gdbserver should fail but did not"
+		} elseif { [llength $res] == 0 } {
+		    unsupported $test
+		    continue
 		} else {
 		    pass "$test"
 		}
diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
index e8ab057647d..727a66e2ab1 100644
--- a/gdb/testsuite/lib/gdbserver-support.exp
+++ b/gdb/testsuite/lib/gdbserver-support.exp
@@ -382,6 +382,9 @@ proc gdbserver_start { options arguments } {
 	    -re ".*: cannot resolve name: .*\r\n" {
 		error "gdbserver cannot resolve name."
 	    }
+	    -re "Can't open socket: Address family not supported by protocol." {
+		return {}
+	    }
 	    timeout {
 		error "Timeout waiting for gdbserver response."
 	    }

base-commit: 29807db8d7b244e3a1a7503237c7b391b3393007
-- 
2.35.3


             reply	other threads:[~2024-03-19  7:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-19  7:48 Tom de Vries [this message]
2024-03-20 17:19 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240319074810.18541-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).