This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH][gdb/testsuite] Handle unreachable network in server-connect.exp
- From: Tom de Vries <tdevries at suse dot de>
- To: gdb-patches at sourceware dot org
- Date: Sat, 14 Sep 2019 12:23:47 +0200
- Subject: [PATCH][gdb/testsuite] Handle unreachable network in server-connect.exp
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 ""
break