From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed 2/3] [gdb/testsuite] Fix gdb.cp/annota{2,3}.exp for native-extended-gdbserver
Date: Wed, 22 Mar 2023 09:38:18 +0100 [thread overview]
Message-ID: <20230322083819.14320-3-tdevries@suse.de> (raw)
In-Reply-To: <20230322083819.14320-1-tdevries@suse.de>
When running test-cases gdb.cp/annota{2,3}.exp with target board
native-extended-gdbserver, we run into a few FAILs, due to the test-cases
trying to match inferior output together with gdb output.
Fix this by ignoring the inferior output in this case.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.cp/annota2.exp | 15 +++++++++++++--
gdb/testsuite/gdb.cp/annota3.exp | 25 +++++++++++++++++--------
2 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/gdb/testsuite/gdb.cp/annota2.exp b/gdb/testsuite/gdb.cp/annota2.exp
index 64adbbdb220..506817bd498 100644
--- a/gdb/testsuite/gdb.cp/annota2.exp
+++ b/gdb/testsuite/gdb.cp/annota2.exp
@@ -126,13 +126,24 @@ gdb_test_multiple "print a" "print class" {
# `a.x is 1' is asynchronous regarding to `frames-invalid'.
#
+if { $gdb_spawn_id == $inferior_spawn_id } {
+ set match_output \
+ [multi_line \
+ "\($frames_invalid\)*a.x is 1" \
+ "\($frames_invalid\)*"]
+} else {
+ # Usually we'd handle this using gdb_test_stdio, but that looks too
+ # complicated in combination with annotations, so just ignore the inferior
+ # output.
+ set match_output "\($frames_invalid\)*"
+}
+
set pat [multi_line "" \
"\032\032post-prompt" \
"Continuing." \
"" \
"\032\032starting" \
- "\(${frames_invalid}\)*a.x is 1" \
- "\(${frames_invalid}\)*"\
+ $match_output \
"\032\032exited 0" \
"$inferior_exited_re normally." \
"" \
diff --git a/gdb/testsuite/gdb.cp/annota3.exp b/gdb/testsuite/gdb.cp/annota3.exp
index 788bda77f3d..7b85c84cd97 100644
--- a/gdb/testsuite/gdb.cp/annota3.exp
+++ b/gdb/testsuite/gdb.cp/annota3.exp
@@ -95,14 +95,23 @@ gdb_expect_list "print class" "$gdb_prompt$" {
# annotate-exited
#
send_gdb "continue\n"
-gdb_expect_list "continue to exit" "$gdb_prompt$" [concat {
- "\r\n\032\032post-prompt\r\n"
- "Continuing.\r\n"
- "\r\n\032\032starting\r\n"
- "a.x is 1\r\n"
- "\r\n\032\032exited 0\r\n"} [list "$inferior_exited_re normally.\r\n"] {
- "\r\n\032\032stopped\r\n"
-}]
+
+set el {}
+lappend el "\r\n\032\032post-prompt\r\n"
+lappend el "Continuing.\r\n"
+lappend el "\r\n\032\032starting\r\n"
+if { $gdb_spawn_id == $inferior_spawn_id } {
+ lappend el "a.x is 1\r\n"
+} else {
+ # Usually we'd handle this using gdb_test_stdio, but that looks too
+ # complicated in combination with annotations, so just ignore the inferior
+ # output.
+}
+lappend el "\r\n\032\032exited 0\r\n"
+lappend el "$inferior_exited_re normally.\r\n"
+lappend el "\r\n\032\032stopped\r\n"
+
+gdb_expect_list "continue to exit" "$gdb_prompt$" $el
#
# delete all breakpoints
--
2.35.3
next prev parent reply other threads:[~2023-03-22 8:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 8:38 [pushed 0/3] [gdb/testsuite] Fix gdb.cp/*.exp for remote host/target Tom de Vries
2023-03-22 8:38 ` [pushed 1/3] [gdb/testsuite] Fix gdb.cp/*.exp for remote host Tom de Vries
2023-03-22 15:05 ` Simon Marchi
2023-03-23 0:18 ` Tom de Vries
2023-03-23 13:49 ` Tom de Vries
2023-03-22 8:38 ` Tom de Vries [this message]
2023-03-22 8:38 ` [pushed 3/3] [gdb/testsuite] Fix gdb.cp/cp-relocate.exp " 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=20230322083819.14320-3-tdevries@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/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).