Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Tom de Vries <tdevries@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/testsuite] Handle unreachable network in server-connect.exp
Date: Tue, 17 Sep 2019 15:40:00 -0000	[thread overview]
Message-ID: <87sgovc4ny.fsf@redhat.com> (raw)
In-Reply-To: <20190914102344.GA5471@delia> (Tom de Vries's message of "Sat, 14	Sep 2019 12:23:47 +0200")

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/


  reply	other threads:[~2019-09-17 15:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-14 10:23 Tom de Vries
2019-09-17 15:40 ` Sergio Durigan Junior [this message]
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=87sgovc4ny.fsf@redhat.com \
    --to=sergiodj@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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