From: Pedro Alves Date: Thu, 3 Jun 2021 18:39:18 +0000 (+0100) Subject: Make gdb.base/long-inferior-output.exp fail fast X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7a884f7b7f0eee8145e9b9e134263348be86f1d0;p=thirdparty%2Fbinutils-gdb.git 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 * gdb.base/long-inferior-output.exp: Don't set "more" when we see an unexpected "this is line number" number. Change-Id: I53e8499bd8fdbf961431a7f2a94d263da6a9f573 --- diff --git a/gdb/testsuite/gdb.base/long-inferior-output.exp b/gdb/testsuite/gdb.base/long-inferior-output.exp index 294786ffff2..c0e18029600 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. + } } }