public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Fix gdb.base/new-ui-pending-input.exp timeout
Date: Mon, 7 Jun 2021 14:34:27 +0200	[thread overview]
Message-ID: <20210607123425.GA8483@delia> (raw)

Hi,

With a testsuite setup modified to make expect wait a little bit longer for
gdb output (see PR27957), I run into:
...
PASS: gdb.base/new-ui-pending-input.exp: spawn gdb
print 1^M
print 2^M
print 3^M
(gdb) $1 = 1^M
(gdb) $2 = 2^M
(gdb) $3 = 3^M
(gdb) PASS: gdb.base/new-ui-pending-input.exp: initial prompt on extra console
^M
Breakpoint 1, main () at new-ui-pending-input.c:25^M
25        return 0; /* set breakpoint here */^M
FAIL: gdb.base/new-ui-pending-input.exp: print 1 on extra console (timeout)
...

Usually, I get a pass instead.  In the passing case, the "initial prompt"
PASS is after the first prompt:
...
PASS: gdb.base/new-ui-pending-input.exp: spawn gdb
print 1^M
print 2^M
print 3^M
(gdb) PASS: gdb.base/new-ui-pending-input.exp: initial prompt on extra console
...
while in the failing case, that PASS is after the fourth prompt.

The regexp doesn't match the first prompt because it terminates with a '$':
...
           -re "$gdb_prompt $" {
...

Fix this by removing the terminating '$' and prefixing the regex with
something unique to the first prompt: "print 3".

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix gdb.base/new-ui-pending-input.exp timeout

gdb/testsuite/ChangeLog:

2021-06-07  Tom de Vries  <tdevries@suse.de>

	* gdb.base/new-ui-pending-input.exp
	(test_command_line_new_ui_pending_input): Fix regexp for "initial
	prompt on extra console".

---
 gdb/testsuite/gdb.base/new-ui-pending-input.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb.base/new-ui-pending-input.exp
index 09e10f9567f..4853f951e86 100644
--- a/gdb/testsuite/gdb.base/new-ui-pending-input.exp
+++ b/gdb/testsuite/gdb.base/new-ui-pending-input.exp
@@ -77,7 +77,7 @@ proc test_command_line_new_ui_pending_input {} {
     with_spawn_id $extra_spawn_id {
 	set test "initial prompt on extra console"
 	gdb_test_multiple "" $test {
-	    -re "$gdb_prompt $" {
+	    -re "\r\nprint 3\r\n$gdb_prompt " {
 		pass $test
 	    }
 	}

                 reply	other threads:[~2021-06-07 12:34 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=20210607123425.GA8483@delia \
    --to=tdevries@suse.de \
    --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).