[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.