aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2021-06-08 14:50:45 +0200
committerTom de Vries <tdevries@suse.de>2021-06-08 14:50:45 +0200
commit4c5d7c03c4dec3dc4ae875696b20747c5a8dafb8 (patch)
treee2463646a342aedd2e387a68841954ea573cf082
parent4a11703a04c64d34e79d51ad62dad176c92462c8 (diff)
downloadgdb-4c5d7c03c4dec3dc4ae875696b20747c5a8dafb8.zip
gdb-4c5d7c03c4dec3dc4ae875696b20747c5a8dafb8.tar.gz
gdb-4c5d7c03c4dec3dc4ae875696b20747c5a8dafb8.tar.bz2
[gdb/testsuite] Fix gdb.base/batch-preserve-term-settings.exp with check-read1
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. 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.
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/batch-preserve-term-settings.exp12
2 files changed, 16 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index dc92125..cd62633 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2021-06-08 Tom de Vries <tdevries@suse.de>
+ * gdb.base/batch-preserve-term-settings.exp (spawn_shell): Fix
+ matching of initial prompt.
+
+2021-06-08 Tom de Vries <tdevries@suse.de>
+
* gdb.threads/multi-create-ns-info-thr.exp: Limit breakpoint regexp to
one line.
diff --git a/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp b/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp
index da39485..1f04209 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
}