From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Fix gdb.base/batch-preserve-term-settings.exp with check-read1
Date: Tue, 8 Jun 2021 14:51:23 +0200 [thread overview]
Message-ID: <20210608125121.GA28163@delia.home> (raw)
Hi,
With check-read1, I run into:
...
FAIL: gdb.base/batch-preserve-term-settings.exp: batch run: \
terminal settings preserved
...
This is caused by spawn_shell matching too little output, after which
things start to go out of sync.
More specifically, the regexp:
...
-re "PS1=\[^\r\n\]*\r\n.*$shell_prompt_re$" {
...
matches the first and part of the second line of this output:
...
PS1="gdb-subshell$ "^M
sh-4.4$ PS1="gdb-subshell$ "^M
gdb-subshell$
...
while it's supposed to match the entire output.
Fix this by splitting up the regexp into a part that skips the lines with PS1,
and one that reads the shell prompt.
Tested on x86_64-linux.
Committed to trunk.
Thanks,
- Tom
[gdb/testsuite] Fix gdb.base/batch-preserve-term-settings.exp with check-read1
gdb/testsuite/ChangeLog:
2021-06-08 Tom de Vries <tdevries@suse.de>
* gdb.base/batch-preserve-term-settings.exp (spawn_shell): Fix
matching of initial prompt.
---
gdb/testsuite/gdb.base/batch-preserve-term-settings.exp | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp b/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp
index da39485c00d..1f042097a06 100644
--- a/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp
+++ b/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp
@@ -44,10 +44,20 @@ proc spawn_shell {} {
send_gdb "PS1=\"$shell_prompt_ps1\"\n"
+ # Try to match:
+ # PS1="gdb-subshell$ "^M
+ # $ gdb-subshell$
+ # or:
+ # PS1="gdb-subshell$ "^M
+ # sh-4.4$ PS1="gdb-subshell$ "^M
+ # gdb-subshell$
set gotit 0
set test "spawn shell"
gdb_expect {
- -re "PS1=\[^\r\n\]*\r\n.*$shell_prompt_re$" {
+ -re "PS1=\"$shell_prompt_re" {
+ exp_continue
+ }
+ -re "$shell_prompt_re$" {
pass $test
set gotit 1
}
reply other threads:[~2021-06-08 12:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210608125121.GA28163@delia.home \
--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).