diff options
author | Tom de Vries <tdevries@suse.de> | 2023-06-21 15:31:37 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2023-06-21 15:31:37 +0200 |
commit | c9966f7a8e71f182734e97a7d149237f2eb89c23 (patch) | |
tree | b4765eb23819e84e5c365ab53a75cde161101322 /gdb | |
parent | 340640f710e690b37c885166949595cde5f827b2 (diff) | |
download | gdb-c9966f7a8e71f182734e97a7d149237f2eb89c23.zip gdb-c9966f7a8e71f182734e97a7d149237f2eb89c23.tar.gz gdb-c9966f7a8e71f182734e97a7d149237f2eb89c23.tar.bz2 |
[gdb/testsuite] Make Term::wait_for "" match only a prompt
The semantics of Term::wait_for is:
...
# Accept some output from gdb and update the screen. WAIT_FOR is
# a regexp matching the line to wait for. Return 0 on timeout, 1
# on success.
proc wait_for {wait_for} {
...
Note that besides the regexp, also a subsequent gdb prompt is matched.
I recently used wait_for "" in a few test-cases, thinking that this would
match just a prompt, but in fact that's not the case.
Fix this in wait_for, and add a corresponding test in gdb.tui/tuiterm-2.exp.
Tested on x86_64-linux.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/gdb.tui/tuiterm-2.exp | 13 | ||||
-rw-r--r-- | gdb/testsuite/lib/tuiterm.exp | 4 |
2 files changed, 17 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.tui/tuiterm-2.exp b/gdb/testsuite/gdb.tui/tuiterm-2.exp index e7a0f03..8e838d3 100644 --- a/gdb/testsuite/gdb.tui/tuiterm-2.exp +++ b/gdb/testsuite/gdb.tui/tuiterm-2.exp @@ -93,6 +93,19 @@ with_override Term::accept_gdb_output test_accept_gdb_output { } gdb_assert { ![Term::command "foo"] } } + + with_test_prefix Term::wait_for { + Term::_setup 4 20 + set send_cnt 0 + set expect_send {} + set action_cnt 0 + set actions { + { + Term::_insert "(gdb) " + } + } + gdb_assert { [Term::wait_for ""] } + } } } } diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index dc928ae..41fa554 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -789,6 +789,10 @@ namespace eval Term { set fn "wait_for" set prompt_wait_for "(^|\\|)$gdb_prompt \$" + if { $wait_for == "" } { + set wait_for $prompt_wait_for + } + debug_tui_matching "$fn: regexp: '$wait_for'" while 1 { |