From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/testsuite] Handle unreachable network in server-connect.exp
Date: Wed, 18 Sep 2019 11:56:00 -0000 [thread overview]
Message-ID: <5f724500-d168-9bbb-139f-c455899b6c82@suse.de> (raw)
In-Reply-To: <87y2ymx0o2.fsf@tromey.com>
[-- Attachment #1: Type: text/plain, Size: 7009 bytes --]
On 17-09-19 20:01, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
>
> Tom> + set res [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport]
> Tom> + if { $res == 0 } {
> Tom> pass $test
> Tom> - } else {
> Tom> + } elseif { $res == 1 } {
> Tom> fail $test
> Tom> + } else {
> Tom> + unsupported $test
>
> Should this treatment be applied to the other callers of gdb_target_cmd?
>
The callers in the test-cases either don't check the result, or compare
to 0, so there it doesn't matter.
But there are uses in f.i. gdbserver-support.exp where the new value
does matter, f.i. in gdbserver_run.
So, I'm attaching an updated patch that does not modify the existing
semantics of gdb_target_cmd.
> I agree with Sergio that the patch is fine, but I wonder if a bigger
> cleanup is warranted here.
FWIW, I did a test run with my laptop switched into flight mode and with
the loopback device removed (sudo ifconfig lo down), and found these new
failures:
...
FAIL: gdb.btrace/reconnect.exp: first: record btrace enable
FAIL: gdb.btrace/reconnect.exp: first: stepi 19 (the program is no
longer running)
FAIL: gdb.btrace/reconnect.exp: first: info record
FAIL: gdb.btrace/reconnect.exp: first: disconnect
FAIL: gdb.btrace/reconnect.exp: second: info record
FAIL: gdb.btrace/reconnect.exp: second: record stop
FAIL: gdb.btrace/reconnect.exp: second: disconnect
FAIL: gdb.btrace/reconnect.exp: third: info record
FAIL: gdb.mi/mi-file-transfer.exp: put binary file (unexpected output)
FAIL: gdb.mi/mi-file-transfer.exp: get binary file (unexpected output)
FAIL: gdb.mi/mi-file-transfer.exp: compare intermediate binary file
FAIL: gdb.mi/mi-file-transfer.exp: compare binary file
FAIL: gdb.mi/mi-file-transfer.exp: deleted binary file (unexpected output)
FAIL: gdb.server/abspath.exp: setting breakpoint at main
FAIL: gdb.server/abspath.exp: continue to main (the program is no longer
running)
FAIL: gdb.server/connect-stopped-target.exp: non-stop=off: connect and
print pc (timeout)
FAIL: gdb.server/connect-stopped-target.exp: non-stop=off: print pc again
FAIL: gdb.server/connect-stopped-target.exp: non-stop=on: connect and
print pc (timeout)
FAIL: gdb.server/connect-stopped-target.exp: non-stop=on: print pc again
FAIL: gdb.server/connect-with-no-symbol-file.exp: sysroot=:
action=permission: connection to GDBserver succeeded
FAIL: gdb.server/connect-with-no-symbol-file.exp: sysroot=:
action=delete: connection to GDBserver succeeded
FAIL: gdb.server/connect-with-no-symbol-file.exp: sysroot=target::
action=permission: connection to GDBserver succeeded
FAIL: gdb.server/connect-with-no-symbol-file.exp: sysroot=target::
action=delete: connection to GDBserver succeeded
FAIL: gdb.server/connect-without-multi-process.exp: multiprocess=off:
target remote (timeout)
FAIL: gdb.server/connect-without-multi-process.exp: multiprocess=off:
continue to main
FAIL: gdb.server/connect-without-multi-process.exp: multiprocess=auto:
target remote (timeout)
FAIL: gdb.server/connect-without-multi-process.exp: multiprocess=auto:
continue to main
FAIL: gdb.server/ext-attach.exp: set remote exec-file
FAIL: gdb.server/ext-attach.exp: monitor exit
FAIL: gdb.server/ext-restart.exp: set remote exec-file
FAIL: gdb.server/ext-restart.exp: monitor exit
FAIL: gdb.server/ext-run.exp: set remote exec-file
FAIL: gdb.server/ext-run.exp: load new file without any gdbserver inferior
FAIL: gdb.server/ext-run.exp: monitor exit
FAIL: gdb.server/ext-wrapper.exp: set remote exec-file
FAIL: gdb.server/ext-wrapper.exp: print d
FAIL: gdb.server/ext-wrapper.exp: restart: print d
FAIL: gdb.server/ext-wrapper.exp: monitor exit
FAIL: gdb.server/file-transfer.exp: put binary file
FAIL: gdb.server/file-transfer.exp: get binary file
FAIL: gdb.server/file-transfer.exp: compare intermediate binary file
FAIL: gdb.server/file-transfer.exp: compare binary file
FAIL: gdb.server/file-transfer.exp: deleted binary file
FAIL: gdb.server/file-transfer.exp: put text file
FAIL: gdb.server/file-transfer.exp: get text file
FAIL: gdb.server/file-transfer.exp: compare intermediate text file
FAIL: gdb.server/file-transfer.exp: compare text file
FAIL: gdb.server/file-transfer.exp: deleted text file
FAIL: gdb.server/no-thread-db.exp: libthread-db is now unresolvable
FAIL: gdb.server/no-thread-db.exp: continue to breakpoint: after tls
assignment (the program is no longer running)
FAIL: gdb.server/no-thread-db.exp: print foo
FAIL: gdb.server/reconnect-ctrl-c.exp: first: connect
FAIL: gdb.server/reconnect-ctrl-c.exp: second: disconnect
FAIL: gdb.server/reconnect-ctrl-c.exp: second: connect
FAIL: gdb.server/run-without-local-binary.exp: connect to gdbserver
(timeout)
FAIL: gdb.server/run-without-local-binary.exp: run test program until
the end
FAIL: gdb.server/server-exec-info.exp: info files
FAIL: gdb.server/server-kill.exp: setting breakpoint at server-kill.c:29
FAIL: gdb.server/server-kill.exp: tstatus
FAIL: gdb.server/server-mon.exp: monitor help
FAIL: gdb.server/server-mon.exp: monitor
FAIL: gdb.server/server-mon.exp: monitor set debug 1
FAIL: gdb.server/server-mon.exp: monitor set debug 0
FAIL: gdb.server/server-mon.exp: monitor set remote-debug 1
FAIL: gdb.server/server-mon.exp: monitor set remote-debug 0
FAIL: gdb.server/server-mon.exp: monitor set debug-format all
FAIL: gdb.server/server-mon.exp: monitor set debug-format none
FAIL: gdb.server/server-run.exp: continue to main (the program is no
longer running)
FAIL: gdb.server/solib-list.exp: non-stop 0: target remote (timeout)
FAIL: gdb.server/solib-list.exp: non-stop 0: continue
FAIL: gdb.server/solib-list.exp: non-stop 0: p libvar
FAIL: gdb.server/solib-list.exp: non-stop 1: target remote (timeout)
FAIL: gdb.server/solib-list.exp: non-stop 1: continue
FAIL: gdb.server/solib-list.exp: non-stop 1: p libvar
FAIL: gdb.server/stop-reply-no-thread.exp: connect
FAIL: gdb.server/sysroot.exp: sysroot=local: connect to remote and read
binary
FAIL: gdb.server/sysroot.exp: sysroot=local: setting breakpoint at main
FAIL: gdb.server/sysroot.exp: sysroot=local: continue to main (got
interactive prompt)
FAIL: gdb.server/sysroot.exp: sysroot=local: setting breakpoint at printf
FAIL: gdb.server/sysroot.exp: sysroot=local: continue to printf (the
program is no longer running)
FAIL: gdb.server/sysroot.exp: sysroot=remote: connect to remote and read
binary
FAIL: gdb.server/sysroot.exp: sysroot=remote: setting breakpoint at main
FAIL: gdb.server/sysroot.exp: sysroot=remote: continue to main (got
interactive prompt)
FAIL: gdb.server/sysroot.exp: sysroot=remote: setting breakpoint at printf
FAIL: gdb.server/sysroot.exp: sysroot=remote: continue to printf (the
program is no longer running)
FAIL: gdb.server/wrapper.exp: setting breakpoint at marker
FAIL: gdb.server/wrapper.exp: continue to marker (the program is no
longer running)
FAIL: gdb.server/wrapper.exp: print d
...
So, I think you're right that a larger cleanup could be done.
But for now, I'd like to focus on this ipv6-specific one.
Thanks,
- Tom
[-- Attachment #2: 0001-gdb-testsuite-Handle-unreachable-network-in-server-connect.exp.patch --]
[-- Type: text/x-patch, Size: 3878 bytes --]
[gdb/testsuite] Handle unreachable network in server-connect.exp
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.
gdb/testsuite/ChangeLog:
2019-09-14 Tom de Vries <tdevries@suse.de>
* lib/gdbserver-support.exp (gdb_target_cmd_ext): Return 2 (meaning
UNSUPPORTED) for 'Network is unreachable' message. Factor out of ...
(gdb_target_cmd): ... here.
* gdb.server/server-connect.exp: Use gdb_target_cmd_ext, handle return
value 2.
---
gdb/testsuite/gdb.server/server-connect.exp | 7 +++++--
gdb/testsuite/lib/gdbserver-support.exp | 16 +++++++++++++---
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/gdb/testsuite/gdb.server/server-connect.exp b/gdb/testsuite/gdb.server/server-connect.exp
index 682fdaaeeb..e69f792a1b 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_ext $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..2ad53c1f60 100644
--- a/gdb/testsuite/lib/gdbserver-support.exp
+++ b/gdb/testsuite/lib/gdbserver-support.exp
@@ -41,12 +41,13 @@
#
#
-# gdb_target_cmd
-# Send gdb the "target" command. Returns 0 on success, 1 on failure.
+# gdb_target_cmd_ext
+# 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.
#
-proc gdb_target_cmd { targetname serialport {additional_text ""} } {
+proc gdb_target_cmd_ext { targetname serialport {additional_text ""} } {
global gdb_prompt
set serialport_re [string_to_regexp $serialport]
@@ -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
@@ -106,6 +110,12 @@ proc gdb_target_cmd { targetname serialport {additional_text ""} } {
return 1
}
+# Like gdb_target_cmd_ext, but returns 0 on success, 1 on failure.
+
+proc gdb_target_cmd { $args } {
+ set res [gdb_target_cmd_ext $args]
+ return [expr $res == 0 ? 0 : 1]
+}
global portnum
set portnum "2345"
next prev parent reply other threads:[~2019-09-18 11:56 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
2019-09-17 18:01 ` Tom Tromey
2019-09-18 11:56 ` Tom de Vries [this message]
[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=5f724500-d168-9bbb-139f-c455899b6c82@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/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