From: Bruno Larsen <blarsen@redhat.com>
To: gdb-patches@sourceware.org
Cc: tdevries@suse.de, Bruno Larsen <blarsen@redhat.com>
Subject: [PATCH] gdb/testsuite: fix completion tests when using READ1
Date: Wed, 26 Jul 2023 15:04:59 +0200 [thread overview]
Message-ID: <20230726130458.1471089-2-blarsen@redhat.com> (raw)
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
reply other threads:[~2023-07-26 13:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230726130458.1471089-2-blarsen@redhat.com \
--to=blarsen@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).