public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH 1/2] gdb/testsuite: fix gdb.ada/complete.exp timeout in READ1 mode
Date: Wed, 29 Nov 2023 17:55:43 +0000	[thread overview]
Message-ID: <9b2fbc186e9610aa92bc0df428e36c7a70aad6a4.1701280438.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1701280438.git.aburgess@redhat.com>

While reviewing another patch I spotted a timeout in
gdb.ada/complete.exp when testing in READ1 mode, e.g.:

  $ make check-read1 TESTS="gdb.ada/complete.exp"
  ...
  FAIL: gdb.ada/complete.exp: complete break ada (timeout)
  ...

The problem is an attempt to match the entire output from GDB within a
single gdb_test_multiple pattern, for a completion command that
returns a large number of completions.

This commit changes the gdb_test_multiple to process the output line
by line.  I don't use the gdb_test_multiple -lbl option, as I've
always found that option backward -- it checks for the \r\n at the
start of each line rather than the end, I think it's much clearer to
use '^' at the start of each pattern, and '\r\n' at the end, so that's
what I've done here.

.... Or I would, if this test didn't already define $eol as the end of
line regexp ... except that $eol was set to '[\r\n]*', which isn't
that helpful, so I've updated $eol to be just '\r\n' the actual end of
line regexp.

And now, the test passes without a timeout when using READ1.

There should be no change in what is tested after this commit.
---
 gdb/testsuite/gdb.ada/complete.exp | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.ada/complete.exp b/gdb/testsuite/gdb.ada/complete.exp
index 9e9250545e9..a73a012d1cc 100644
--- a/gdb/testsuite/gdb.ada/complete.exp
+++ b/gdb/testsuite/gdb.ada/complete.exp
@@ -28,7 +28,7 @@ clean_restart ${testfile}
 set bp_location [gdb_get_line_number "START" ${testdir}/foo.adb]
 runto "foo.adb:$bp_location"
 
-set eol "\[\r\n\]*"
+set eol "\r\n"
 
 # A convenience function that verifies that the "complete EXPR" command
 # returns the EXPECTED_OUTPUT.
@@ -227,11 +227,20 @@ test_gdb_complete "ambiguous_func" \
 gdb_test_no_output "set max-completions unlimited"
 
 set test "complete break ada"
-gdb_test_multiple "$test" $test {
-    -re "^$test$eol\(break ada\[\]\[a-z0-9._@/-\]*$eol\)+$gdb_prompt $" {
-        pass $test
+gdb_test_multiple $test "" {
+    -re "^($test$eol)" {
+	exp_continue
     }
+
+    -re "^(break ada\[\]\[a-z0-9._@/-\]*$eol)" {
+	exp_continue
+    }
+
+    -re "^$gdb_prompt $" {
+	pass $gdb_test_name
+    }
+
     -re "\[A-Z\].*$gdb_prompt $" {
-	fail "$test (gdb/22670)"
+	fail "$gdb_test_name (gdb/22670)"
     }
 }
-- 
2.25.4


  reply	other threads:[~2023-11-29 17:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29 17:55 [PATCH 0/2] A few minor testsuite cleanups Andrew Burgess
2023-11-29 17:55 ` Andrew Burgess [this message]
2023-11-30 19:22   ` [PATCH 1/2] gdb/testsuite: fix gdb.ada/complete.exp timeout in READ1 mode Tom Tromey
2023-11-29 17:55 ` [PATCH 2/2] gdb/testsuite: tighten up some end-of-line patterns Andrew Burgess
2023-11-30 19:23   ` Tom Tromey
2023-12-08 22:25     ` Tom de Vries
2023-12-09  6:59       ` Tom de Vries
2023-12-11 14:52         ` Andrew Burgess
2023-12-11 14:55           ` Tom de Vries
2023-12-11 16:16             ` Tom de Vries
2023-12-11 16:44               ` Andrew Burgess
2023-12-08 18:07 ` [PATCH 0/2] A few minor testsuite cleanups Andrew Burgess

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=9b2fbc186e9610aa92bc0df428e36c7a70aad6a4.1701280438.git.aburgess@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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).