[gdb/testsuite] Introduce allow_dap_tests
Commit Message
Simon pointed out that with gdb.dap/*.exp and target board
native-gdbserver, we run into problems.
I see for each test-case:
...
+++ run
Traceback (most recent call last):
File "startup.py", line 146, in exec_and_log
output = gdb.execute(cmd, from_tty=True, to_string=True)
gdb.error: Don't know how to run. Try "help target".
...
Likewise with target board native-extended-gdbserver.
Fix this by:
- adding a new proc allow_dap_tests,
- using it in all the gdb.dap tests, and
- bailing out if GDBFLAGS/INTERNAL_GDBFLAGS contain
"set auto-connect-native-target off".
Tested on x86_64-linux.
Reported-By: Simon Marchi <simon.marchi@efficios.com>
---
gdb/testsuite/gdb.dap/basic-dap.exp | 2 +-
gdb/testsuite/gdb.dap/bt-nodebug.exp | 2 ++
gdb/testsuite/gdb.dap/scopes.exp | 2 +-
gdb/testsuite/lib/gdb.exp | 15 +++++++++++++++
4 files changed, 19 insertions(+), 2 deletions(-)
base-commit: f06b840b9a063aa33b8b50745bddc8e6845c8f29
Comments
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> Likewise with target board native-extended-gdbserver.
Yeah. There's not really a well-defined way in DAP to ask gdb to
connect to a remote target. I assume we'll add an extension for this at
some point, but we haven't done it yet. (There's some existing request
that has adapter-defined arguments that we can use, but I don't recall
what right now.)
Tom> Fix this by:
Tom> - adding a new proc allow_dap_tests,
Tom> - using it in all the gdb.dap tests, and
Tom> - bailing out if GDBFLAGS/INTERNAL_GDBFLAGS contain
Tom> "set auto-connect-native-target off".
Tom> Tested on x86_64-linux.
Looks good, thank you.
Tom
@@ -15,7 +15,7 @@
# Basic DAP test.
-require allow_python_tests
+require allow_dap_tests
load_lib dap-support.exp
@@ -15,6 +15,8 @@
# Test DAP 'bt' through a function without debuginfo.
+require allow_dap_tests
+
load_lib dap-support.exp
standard_testfile bt-main.c bt-inner.c
@@ -15,7 +15,7 @@
# Test "scopes" and "variables".
-require allow_python_tests
+require allow_dap_tests
load_lib dap-support.exp
@@ -2488,6 +2488,21 @@ gdb_caching_proc allow_python_tests {} {
return [expr {[string first "--with-python" $output] != -1}]
}
+gdb_caching_proc allow_dap_tests {} {
+ if { ![allow_python_tests] } {
+ return 0
+ }
+
+ # With set auto-connect-native-target off, we run into:
+ # +++ run
+ # Traceback (most recent call last):
+ # File "startup.py", line <n>, in exec_and_log
+ # output = gdb.execute(cmd, from_tty=True, to_string=True)
+ # gdb.error: Don't know how to run. Try "help target".
+ set gdb_flags [join $::GDBFLAGS $::INTERNAL_GDBFLAGS]
+ return [expr {[string first "set auto-connect-native-target off" $gdb_flags] == -1}]
+}
+
# Return a 1 if we should run shared library tests.
proc allow_shlib_tests {} {