public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/3] [gdb/testsuite] Fix -wrap in presence of -prompt in gdb_test_multiple
Date: Fri, 21 Apr 2023 16:58:31 +0200	[thread overview]
Message-ID: <20230421145833.24521-2-tdevries@suse.de> (raw)
In-Reply-To: <20230421145833.24521-1-tdevries@suse.de>

While writing a gdb_test_multiple call in a test-case I tried to use -wrap in
combination with -prompt and found out that it doesn't work, because -wrap uses
"$gdb_prompt $" instead of $prompt_regexp.

Fix this by making -wrap use $prompt_regexp.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.testsuite/gdb-test.exp | 11 +++++++++++
 gdb/testsuite/lib/gdb.exp                |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.testsuite/gdb-test.exp b/gdb/testsuite/gdb.testsuite/gdb-test.exp
index a582b1b125f..e19f2a8de4a 100644
--- a/gdb/testsuite/gdb.testsuite/gdb-test.exp
+++ b/gdb/testsuite/gdb.testsuite/gdb-test.exp
@@ -48,3 +48,14 @@ with_test_prefix "cmd with trailing control code" {
 	gdb_assert { [string equal $output $expected_error_msg] }
     }
 }
+
+# Change the prompt.
+set prompt "(GDB) "
+set prompt_re "\\(GDB\\) $"
+gdb_test -prompt $prompt_re "set prompt $prompt"
+
+gdb_test_multiple "print 1" "" -prompt $prompt_re {
+    -re -wrap " = 1" {
+	pass $gdb_test_name
+    }
+}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 9ea0334759d..fec64ed1e6c 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1126,7 +1126,7 @@ proc gdb_test_multiple { command message args } {
 	if { $wrap_pattern } {
 	    # Wrap subst_item as is done for the gdb_test PATTERN argument.
 	    lappend $current_list \
-		"\[\r\n\]*(?:$subst_item)\[\r\n\]+$gdb_prompt $"
+		"\[\r\n\]*(?:$subst_item)\[\r\n\]+$prompt_regexp"
 	    set wrap_pattern 0
 	} else {
 	    lappend $current_list $subst_item
-- 
2.35.3


  reply	other threads:[~2023-04-21 14:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-21 14:58 [PATCH 0/3] [gdb/testsuite] Fix gdb.gdb/python-helper.exp with -O2 -flto Tom de Vries
2023-04-21 14:58 ` Tom de Vries [this message]
2023-04-21 14:58 ` [PATCH 2/3] " Tom de Vries
2023-04-21 14:58 ` [PATCH 3/3] [gdb/testsuite] Fix auto-indent in gdb.gdb/python-helper.exp Tom de Vries
2023-04-24 17:09 ` [PATCH 0/3] [gdb/testsuite] Fix gdb.gdb/python-helper.exp with -O2 -flto 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=20230421145833.24521-2-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).