From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>, Tom Tromey <tom@tromey.com>
Subject: [PATCH] [gdb/testsuite] Introduce allow_dap_tests
Date: Sat, 25 Mar 2023 07:16:09 +0100 [thread overview]
Message-ID: <20230325061609.32678-1-tdevries@suse.de> (raw)
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(-)
diff --git a/gdb/testsuite/gdb.dap/basic-dap.exp b/gdb/testsuite/gdb.dap/basic-dap.exp
index 5e6e1b5d6d4..0026690ba44 100644
--- a/gdb/testsuite/gdb.dap/basic-dap.exp
+++ b/gdb/testsuite/gdb.dap/basic-dap.exp
@@ -15,7 +15,7 @@
# Basic DAP test.
-require allow_python_tests
+require allow_dap_tests
load_lib dap-support.exp
diff --git a/gdb/testsuite/gdb.dap/bt-nodebug.exp b/gdb/testsuite/gdb.dap/bt-nodebug.exp
index e365f0877d4..e4dcef35a67 100644
--- a/gdb/testsuite/gdb.dap/bt-nodebug.exp
+++ b/gdb/testsuite/gdb.dap/bt-nodebug.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
diff --git a/gdb/testsuite/gdb.dap/scopes.exp b/gdb/testsuite/gdb.dap/scopes.exp
index 0fa9e211105..2c4b9ed81a5 100644
--- a/gdb/testsuite/gdb.dap/scopes.exp
+++ b/gdb/testsuite/gdb.dap/scopes.exp
@@ -15,7 +15,7 @@
# Test "scopes" and "variables".
-require allow_python_tests
+require allow_dap_tests
load_lib dap-support.exp
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index dd392477b9a..3cfe22b32cd 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.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 {} {
base-commit: f06b840b9a063aa33b8b50745bddc8e6845c8f29
--
2.35.3
next reply other threads:[~2023-03-25 6:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-25 6:16 Tom de Vries [this message]
2023-03-25 20:31 ` Tom Tromey
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=20230325061609.32678-1-tdevries@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).