public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Fix latent bug in test_gdb_complete_cmd_multiple
@ 2019-07-03 16:27 Pedro Alves
  0 siblings, 0 replies; only message in thread
From: Pedro Alves @ 2019-07-03 16:27 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a994424fa1e80d982644038f1ce6538e247aeed1

commit a994424fa1e80d982644038f1ce6538e247aeed1
Author: Pedro Alves <palves@redhat.com>
Date:   Wed Jul 3 16:57:50 2019 +0100

    Fix latent bug in test_gdb_complete_cmd_multiple
    
    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:
    2019-07-03  Pedro Alves  <palves@redhat.com>
    
    	* lib/completion-support.exp (test_gdb_complete_cmd_multiple): Use
    	string_to_regexp.

Diff:
---
 gdb/testsuite/ChangeLog                  | 5 +++++
 gdb/testsuite/lib/completion-support.exp | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8a426ff..601348f 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
 2019-07-03  Pedro Alves  <palves@redhat.com>
 
+	* lib/completion-support.exp (test_gdb_complete_cmd_multiple): Use
+	string_to_regexp.
+
+2019-07-03  Pedro Alves  <palves@redhat.com>
+
 	* gdb.base/options.exp (expect_none, expect_flag, expect_bool)
 	(expect_integer): Adjust to expect "-string".
 	(expect_string): New.
diff --git a/gdb/testsuite/lib/completion-support.exp b/gdb/testsuite/lib/completion-support.exp
index 3199e85..abe48b4 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"]


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-07-03 16:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03 16:27 [binutils-gdb] Fix latent bug in test_gdb_complete_cmd_multiple Pedro Alves

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).