From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH][gdb/testsuite] Handle unreachable network in server-connect.exp
Date: Sat, 14 Sep 2019 10:23:00 -0000 [thread overview]
Message-ID: <20190914102344.GA5471@delia> (raw)
Hi,
When running gdb.server/server-connect.exp I run into:
...
FAIL: gdb.server/server-connect.exp: tcp6: connect to gdbserver using tcp6:::1
FAIL: gdb.server/server-connect.exp: tcp6-with-brackets: connect to gdbserver \
using tcp6:[::1]
FAIL: gdb.server/server-connect.exp: udp6: connect to gdbserver using udp6:::1
FAIL: gdb.server/server-connect.exp: udp6-with-brackets: connect to gdbserver \
using udp6:[::1]
...
The FAIL is caused by the fact that the ipv6 loopback address is not available:
...
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
tcp6:::1:2347: Network is unreachable.^M
(gdb) FAIL: gdb.server/server-connect.exp: tcp6: connect to gdbserver using tcp6:::1
...
This should be marked UNSUPPORTED rather than FAIL.
Furthermore, the test-case takes about 4 minutes, because the 'Network is
unreachable' response is not explicitly handled in gdb_target_cmd, so instead
it runs into the timeout case.
Fix this by handling the 'Network is unreachable' response as UNSUPPORTED.
This reduces testing time from 4 minutes to about 2 seconds.
Tested on x86_64-linux.
OK for trunk?
Thanks,
- Tom
[gdb/testsuite] Handle unreachable network in server-connect.exp
gdb/testsuite/ChangeLog:
2019-09-14 Tom de Vries <tdevries@suse.de>
* lib/gdbserver-support.exp (gdb_target_cmd): Return 2 (meaning
UNSUPPORTED) for 'Network is unreachable' message.
* gdb.server/server-connect.exp: Handle gdb_target_cmd returning 2.
---
gdb/testsuite/gdb.server/server-connect.exp | 7 +++++--
gdb/testsuite/lib/gdbserver-support.exp | 6 +++++-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/gdb/testsuite/gdb.server/server-connect.exp b/gdb/testsuite/gdb.server/server-connect.exp
index 682fdaaeeb..96d3c4215a 100644
--- a/gdb/testsuite/gdb.server/server-connect.exp
+++ b/gdb/testsuite/gdb.server/server-connect.exp
@@ -101,10 +101,13 @@ save_vars { GDB_TEST_SOCKETHOST } {
set gdbserver_gdbport [lindex $res 1]
set test "connect to gdbserver using $sockhost"
- if { [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport] == 0 } {
+ set res [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport]
+ if { $res == 0 } {
pass $test
- } else {
+ } elseif { $res == 1 } {
fail $test
+ } else {
+ unsupported $test
}
}
}
diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
index ade99c0ea1..5b5140b86c 100644
--- a/gdb/testsuite/lib/gdbserver-support.exp
+++ b/gdb/testsuite/lib/gdbserver-support.exp
@@ -42,7 +42,8 @@
#
# gdb_target_cmd
-# Send gdb the "target" command. Returns 0 on success, 1 on failure.
+# Send gdb the "target" command. Returns 0 on success, 1 on failure, 2 on
+# unsupported.
# If specified, then ADDITIONAL_TEXT must match the text that comes after
# the connection message in order for the procedure to succeed.
#
@@ -97,6 +98,9 @@ proc gdb_target_cmd { targetname serialport {additional_text ""} } {
# Leave it there for the test to diagnose.
return 1
}
+ -re ": Network is unreachable.\r\n.*$gdb_prompt $" {
+ return 2
+ }
timeout {
send_gdb "\x03"
break
next reply other threads:[~2019-09-14 10:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-14 10:23 Tom de Vries [this message]
2019-09-17 15:40 ` Sergio Durigan Junior
2019-09-17 18:01 ` Tom Tromey
2019-09-18 11:56 ` Tom de Vries
[not found] ` <871rwdthw0.fsf@tromey.com>
2019-09-18 23:16 ` Tom de Vries
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=20190914102344.GA5471@delia \
--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