public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 4/5] Fix latent bug in test_gdb_complete_cmd_multiple
Date: Thu, 27 Jun 2019 19:14:00 -0000	[thread overview]
Message-ID: <20190627191427.20742-5-palves@redhat.com> (raw)
In-Reply-To: <20190627191427.20742-1-palves@redhat.com>

A following patch will add the following to a testcase:

  test_gdb_completion_offers_commands "| "

And that tripped on a latent testsuite bug:

 (gdb) | PASS: gdb.base/shell.exp: tab complete "| "
 ^CQuit
 (gdb) complete |
 | !
 | +
 PASS: gdb.base/shell.exp: cmd complete "| "
 |  *** List may be truncated, max-completions reached. ***
 (gdb) FAIL: gdb.base/shell.exp: set max-completions 200
 set max-completions 200

The issue is that "|" ends up as part of a regexp, and "|" in regexps
has a special meaning...

Fix this with string_to_regexp.

gdb/testsuite/ChangeLog:
yyyy-mm-dd  Pedro Alves  <palves@redhat.com>

	* lib/completion-support.exp (test_gdb_complete_cmd_multiple): Use
	string_to_regexp.
---
 gdb/testsuite/lib/completion-support.exp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/completion-support.exp b/gdb/testsuite/lib/completion-support.exp
index 3199e85fd4d..abe48b4a7f7 100644
--- a/gdb/testsuite/lib/completion-support.exp
+++ b/gdb/testsuite/lib/completion-support.exp
@@ -200,8 +200,9 @@ proc test_gdb_complete_cmd_multiple { cmd_prefix completion_word completion_list
     set expected_re [make_cmd_completion_list_re $cmd_prefix $completion_list $start_quote_char $end_quote_char]
 
     if {$max_completions} {
+	set cmd_prefix_re [string_to_regexp $cmd_prefix]
 	append expected_re \
-	    "$cmd_prefix \\*\\*\\* List may be truncated, max-completions reached\\. \\*\\*\\*.*\r\n"
+	    "$cmd_prefix_re \\*\\*\\* List may be truncated, max-completions reached\\. \\*\\*\\*.*\r\n"
     }
 
     set cmd_re [string_to_regexp "complete $cmd_prefix$completion_word"]
-- 
2.14.5

  parent reply	other threads:[~2019-06-27 19:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-27 19:14 [PATCH 0/5] pipe command completer, and string options Pedro Alves
2019-06-27 19:14 ` [PATCH 5/5] pipe command completer Pedro Alves
2019-06-28 15:16   ` Tom Tromey
2019-07-03 16:28     ` Pedro Alves
2019-06-27 19:14 ` [PATCH 2/5] Make gdb::option::complete_options save processed arguments too Pedro Alves
2019-06-27 19:14 ` [PATCH 3/5] Teach gdb::option about string options Pedro Alves
2019-06-28 15:11   ` Tom Tromey
2019-07-03 16:25     ` Pedro Alves
2019-06-27 19:14 ` Pedro Alves [this message]
2019-06-28 14:53   ` [PATCH 4/5] Fix latent bug in test_gdb_complete_cmd_multiple Tom Tromey
2019-06-28 14:56     ` Pedro Alves
2019-06-28 15:46       ` Tom Tromey
2019-06-27 19:14 ` [PATCH 1/5] Fix test_gdb_complete_tab_multiple race Pedro Alves
2019-06-28 15:16 ` [PATCH 0/5] pipe command completer, and string options Tom Tromey

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=20190627191427.20742-5-palves@redhat.com \
    --to=palves@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).