aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2021-06-03 19:39:18 +0100
committerPedro Alves <pedro@palves.net>2021-06-14 21:31:28 +0100
commit7a884f7b7f0eee8145e9b9e134263348be86f1d0 (patch)
tree5709f03e9134bac9d2e9e5161f25188757fddc64
parent0d599db17dfb32f78b8b0bb02e98257c82c62e14 (diff)
downloadfsf-binutils-gdb-7a884f7b7f0eee8145e9b9e134263348be86f1d0.zip
fsf-binutils-gdb-7a884f7b7f0eee8145e9b9e134263348be86f1d0.tar.gz
fsf-binutils-gdb-7a884f7b7f0eee8145e9b9e134263348be86f1d0.tar.bz2
Make gdb.base/long-inferior-output.exp fail fast
A local change I was working on had a bug that made GDB lose inferior output, which was caught by the gdb.base/long-inferior-output.exp testcase. While debugging the problem, I found it useful to have the testcase fail quickly when it noticed output was missing. Also, tighten the regexes to make sure that we don't get spurious/repeated/bogus output between each "this is line number ..." line. gdb/testsuite/ChangeLog: yyyy-mm-dd Pedro Alves <pedro@palves.net> * gdb.base/long-inferior-output.exp: Don't set "more" when we see an unexpected "this is line number" number. Change-Id: I53e8499bd8fdbf961431a7f2a94d263da6a9f573
-rw-r--r--gdb/testsuite/gdb.base/long-inferior-output.exp31
1 files changed, 28 insertions, 3 deletions
diff --git a/gdb/testsuite/gdb.base/long-inferior-output.exp b/gdb/testsuite/gdb.base/long-inferior-output.exp
index 294786f..c0e1802 100644
--- a/gdb/testsuite/gdb.base/long-inferior-output.exp
+++ b/gdb/testsuite/gdb.base/long-inferior-output.exp
@@ -47,21 +47,46 @@ if { ![runto_main] } then {
set printing_done_line [gdb_get_line_number "printing done"]
gdb_test "break $printing_done_line" ".*" "set breakpoint after printing"
-send_gdb "continue\n"
+gdb_test_multiple "continue" "" {
+ -re "Continuing\.\r\n" {
+ pass $gdb_test_name
+ }
+}
set expected_lines 3000
set more 1
set i 0
while {$more} {
set more 0
+
+ # Make sure that we don't get spurious/repeated/bogus output
+ # between each "this is line number ..." line, with an anchor.
+ # But consume any output that precedes the first line, because
+ # when testing against GDBserver, we'll get:
+ #
+ # continue
+ # Continuing.
+ # PASS: gdb.base/long-inferior-output.exp: continue
+ # Remote debugging from host ::1, port 40044
+ # this is line number 0
+ # ...
+ if {$i != 0} {
+ set anchor "^"
+ } else {
+ set anchor ""
+ }
+
gdb_expect {
-i $inferior_spawn_id
- -ex "this is line number $i" {
+ -re "${anchor}this is line number $i\r\n" {
incr i
- if {$i != $expected_lines} {
+ if {$i != $expected_lines} {
set more 1
}
}
+ -re "this is line number \[^\r\n\]*\r\n" {
+ # If we see this, we've lost output.
+ }
}
}