* [PATCH] gdb/testsuite: fix completion tests when using READ1
@ 2023-07-26 13:04 Bruno Larsen
0 siblings, 0 replies; only message in thread
From: Bruno Larsen @ 2023-07-26 13:04 UTC (permalink / raw)
To: gdb-patches; +Cc: tdevries, Bruno Larsen
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(-)
diff --git a/gdb/testsuite/lib/completion-support.exp b/gdb/testsuite/lib/completion-support.exp
index ea73c3bb367..9e76d7c9eb6 100644
--- a/gdb/testsuite/lib/completion-support.exp
+++ b/gdb/testsuite/lib/completion-support.exp
@@ -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
+ }
}
}
--
2.41.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-07-26 13:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-26 13:04 [PATCH] gdb/testsuite: fix completion tests when using READ1 Bruno Larsen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).