This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH][gdb/testsuite] Handle unreachable network in server-connect.exp
- From: Sergio Durigan Junior <sergiodj at redhat dot com>
- To: Tom de Vries <tdevries at suse dot de>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 17 Sep 2019 11:40:17 -0400
- Subject: Re: [PATCH][gdb/testsuite] Handle unreachable network in server-connect.exp
- References: <20190914102344.GA5471@delia>
On Saturday, September 14 2019, Tom de Vries wrote:
> 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 for the patch. It LGTM (I can't approve it though).
> 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
--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/