gdb/testsuite: fix completion tests when using READ1
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
fail
|
Testing failed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Testing passed
|
Commit Message
The commit a3da2e7e550c4fe79128b5e532dbb90df4d4f418 has introduced
regressions when testing using the READ1 mechanism. The reason for that
is the new failure path in proc test_gdb_complete_tab_unique, which
looks for GDB suggesting more than what the test inputted, but not the
correct answer, followed by a white space. Consider the following case:
int foo(int bar, int baz);
Sending the command "break foo<tab>" to GDB will return
break foo(int, int)
which easily fits the buffer in normal testing, so everything works, but
when reading one character at a time, the test will find the partial
"break foo(int, " and assume that there was a mistake, so we get a
spurious FAIL.
To fix these errors, this commit makes it so the relevant section is
only evaluated when the test is not being run with the READ1 mechanism.
---
With these changes, I only see a failure that was not introduced by my
original patch, when testing gdb.ada/complete.exp due to too much
output, I think.
---
gdb/testsuite/lib/completion-support.exp | 30 +++++++++++++++++-------
1 file changed, 21 insertions(+), 9 deletions(-)
@@ -113,16 +113,28 @@ proc test_gdb_complete_tab_unique { input_line complete_line_re append_char_re }
send_gdb "$input_line\t"
set partial_complete [string_to_regexp $input_line]
set res 1
- gdb_test_multiple "" "$test" {
- -re "^$complete_line_re$append_char_re$" {
- pass "$test"
- }
- -re "$partial_complete\[^ \]+ $" {
- fail "$test"
+ if { ![info exists ::env(READ1)] || $::env(READ1) == ""} {
+ gdb_test_multiple "" "$test" {
+ -re "^$complete_line_re$append_char_re$" {
+ pass "$test"
+ }
+ -re "$partial_complete\[^ \]+ $" {
+ fail "$test"
+ }
+ timeout {
+ fail "$test (timeout)"
+ set res -1
+ }
}
- timeout {
- fail "$test (timeout)"
- set res -1
+ } else {
+ gdb_test_multiple "" "$test" {
+ -re "^$complete_line_re$append_char_re$" {
+ pass "$test"
+ }
+ timeout {
+ fail "$test (timeout)"
+ set res -1
+ }
}
}