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/6] Fix racy output matching in gdb.base/cpcompletion.exp
Date: Thu, 26 Oct 2017 17:42:00 -0000	[thread overview]
Message-ID: <1509039747-15026-5-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <1509039747-15026-1-git-send-email-palves@redhat.com>

With:

 $ make check-read1 TESTS="gdb.cp/cpcompletion.exp"

we get (from gdb.log):

 (gdb) complete break Foo::
 break Foo::Foo()
 break Foo::Foofoo()
 break Foo::get_foo()
 break Foo::set_foo(int)
 break Foo::~Foo()
 (gdb) FAIL: gdb.cp/cpcompletion.exp: complete class methods (Foo not found)

The problem is that the
  "break ${class}::\[A-Za-z0-9_~\]+"
regexp patches partial input, like:
  break Foo::F
  break Foo::Fo
  break Foo::Foo
etc.

Fix that by expecting each whole line.

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

	* gdb.cp/cpcompletion.exp (test_class_complete): Tighten regex to
	match till end of line.
---
 gdb/testsuite/gdb.cp/cpcompletion.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.cp/cpcompletion.exp b/gdb/testsuite/gdb.cp/cpcompletion.exp
index d4da1d2..c7883ee 100644
--- a/gdb/testsuite/gdb.cp/cpcompletion.exp
+++ b/gdb/testsuite/gdb.cp/cpcompletion.exp
@@ -26,7 +26,7 @@ proc test_class_complete {class expr name matches} {
     gdb_test_multiple $cmd $name {
 	"break ${class}::main" { fail "$name (saw global symbol)" }
 	$cmd { exp_continue }
-	-re "break ${class}::\[A-Za-z0-9_~\]+" {
+	-re "break ${class}::\[^\r\n\]*\r\n" {
 	    set str $expect_out(0,string)
 	    scan $str "break ${class}::%\[^(\]" method
 	    lappend seen $method
-- 
2.5.5

  parent reply	other threads:[~2017-10-26 17:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-26 17:42 [PATCH 0/6] Fix several cases of racy output matching Pedro Alves
2017-10-26 17:42 ` [PATCH 2/6] Fix racy output matching in gdb.base/completion.exp Pedro Alves
2017-10-26 17:42 ` [PATCH 5/6] Fix racy output matching in gdb.base/multi-attach.exp, gdb.server/ext-{attach, restart, ext-run}.exp Pedro Alves
2017-10-26 17:42 ` [PATCH 3/6] Fix racy output matching in gdb.base/memattr.exp Pedro Alves
2017-10-26 17:42 ` [PATCH 6/6] Fix racy output matching in gdb.tui/tui-completion.exp Pedro Alves
2017-11-15 16:09   ` Simon Marchi
2017-11-15 16:16     ` Pedro Alves
2017-10-26 17:42 ` Pedro Alves [this message]
2017-10-26 17:42 ` [PATCH 1/6] Fix racy output matching in gdb.asm/asm-source.exp Pedro Alves
2017-11-09 22:50 ` [PATCH 0/6] Fix several cases of racy output matching Pedro Alves

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=1509039747-15026-5-git-send-email-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).