This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 4/6] Fix racy output matching in gdb.base/cpcompletion.exp


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]