[gdb/testsuite] Fix gdb.threads/fork-plus-threads.exp with check-readmore

When running test-case gdb.threads/fork-plus-threads.exp with check-readmore,
I run into:
...
[Inferior 11 (process 7029) exited normally]^M
[Inferior 1 (process 6956) exited normally]^M
FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: \
  inferior 1 exited (timeout)
...

The problem is that the regexp consuming the "Inferior exited normally"
messages:
- consumes more than one of those messages at a time, but
- counts only one of those messages.

Fix this by adopting a line-by-line approach, which deals with those messages
one at a time.

Tested on x86_64-linux with native, check-read1 and check-readmore.
This commit is contained in:
Tom de Vries
2022-05-08 13:53:41 +02:00
parent 07d9774171
commit efd1a8512f

View File

@ -88,23 +88,15 @@ proc do_test { detach-on-fork } {
set test "inferior 1 exited" set test "inferior 1 exited"
gdb_test_multiple "" $test { gdb_test_multiple "" $test {
-re "Cannot remove breakpoints" { -re "^Cannot remove breakpoints" {
set saw_cannot_remove_breakpoints 1 set saw_cannot_remove_breakpoints 1
exp_continue exp_continue
} }
-re "Thread \[^\r\n\]+ stopped\\." { -re "^\\\[Thread \[^\r\n\]+ stopped\\." {
set saw_thread_stopped 1 set saw_thread_stopped 1
exp_continue exp_continue
} }
-re "(Thread|LWP) \[^\r\n\]+ exited" { -re "^\\\[Inferior ($::decimal) \(\[^\r\n\]+\) exited normally\\\]" {
# Avoid timeout with check-read1
exp_continue
}
-re "New (Thread|LWP) \[^\r\n\]+" {
# Avoid timeout with check-read1
exp_continue
}
-re "Inferior ($::decimal) \(\[^\r\n\]+\) exited normally" {
set infnum $expect_out(1,string) set infnum $expect_out(1,string)
incr num_inferior_exits_seen incr num_inferior_exits_seen
incr inferior_exits_seen($infnum) 1 incr inferior_exits_seen($infnum) 1
@ -115,6 +107,10 @@ proc do_test { detach-on-fork } {
exp_continue exp_continue
} }
} }
-re "^\[^\r\n]*\r\n" {
# Skip line.
exp_continue
}
} }
# Verify that we got all the inferior exits we expected. # Verify that we got all the inferior exits we expected.