Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] testsuite: MI: racy results in async mode (PR testsuite/12649)
@ 2011-10-27 10:16 Jan Kratochvil
  2011-10-27 16:49 ` Tom Tromey
  2011-11-01 15:40 ` [patch] testsuite: MI: racy results in async mode (PR testsuite/12649) Doug Evans
  0 siblings, 2 replies; 16+ messages in thread
From: Jan Kratochvil @ 2011-10-27 10:16 UTC (permalink / raw)
  To: gdb-patches; +Cc: Marek Polacek

Hi,

I was looking at some systematic-like regression but it was just a race again.

The fix is ugly but it cannot be done better before there is a generic MI
client parser deployed for the testsuite.

$prompt_re is "" in this case, therefore the =breakpoint-deleted async
notification is randomly left or swallowed by the end of regex in
mi_expect_stop:
        -re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {

No regressions on {x86_64,x86_64-m32,i686}-fedora16pre-linux-gnu and with
gdbserver.

I will check it in in some time.


Thanks,
Jan


PASS->FAIL log during a random regression:

 =breakpoint-modified,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0804859b",func="main",file="gdb/testsuite/gdb.mi/nsmoribund.c",fullname="gdb/testsuite/gdb.mi/nsmoribund.c",line="55",times="1",original-location="main"}^M
-*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x0804859b",func="main",args=[{name="argc",value="1"},{name="argv",value="0xffffd004"}],file="gdb/testsuite/gdb.mi/nsmoribund.c",fullname="gdb/testsuite/gdb.mi/nsmoribund.c",line="55"},thread-id="1",stopped-threads=["1"],core="7"^M
-=breakpoint-deleted,id="1"^M
+*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x0804859b",func="main",args=[{name="argc",value="1"},{name="argv",value="0xffffd004"}],file="gdb/testsuite/gdb.mi/nsmoribund.c",fullname="gdb/testsuite/gdb.mi/nsmoribund.c",line="55"},thread-id="1",stopped-threads=["1"],core="1"^M
 PASS: gdb.mi/mi-nsmoribund.exp: mi runto main
 Expecting: 222\^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr=".*",func="thread_function",file=".*",fullname=".*",line=".*",times="0",original-location=".*"}
 Expecting: ^(222-break-insert nsmoribund\.c:39[^M
 ]+)?(222\^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr=".*",func="thread_function",file=".*",fullname=".*",line=".*",times="0",original-location=".*"}[^M
 ]+[(]gdb[)] ^M
 [ ]*)
+=breakpoint-deleted,id="1"^M
 222-break-insert nsmoribund.c:39^M
 222^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x08048552",func="thread_function",file="gdb/testsuite/gdb.mi/nsmoribund.c",fullname="gdb/testsuite/gdb.mi/nsmoribund.c",line="39",times="0",original-location="nsmoribund.c:39"}^M
 (gdb) ^M
-PASS: gdb.mi/mi-nsmoribund.exp: breakpoint at thread_function
+FAIL: gdb.mi/mi-nsmoribund.exp: breakpoint at thread_function
 -exec-continue --all^M
 ^running^M
 *running,thread-id="1"^M


gdb/testsuite/
2011-10-27  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* lib/mi-support.exp (breakpoint_re): Suppress match reporting.
	(mi_gdb_test): Import globals thread_selected_re
	and breakpoint_re.  Expect them optionally at the regex start.

--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -32,7 +32,7 @@ set MIFLAGS "-i=mi"
 
 set thread_selected_re "=thread-selected,id=\"\[0-9\]+\"\r\n"
 set library_loaded_re "=library-loaded\[^\n\]+\"\r\n"
-set breakpoint_re "=(breakpoint-created|breakpoint-deleted)\[^\n\]+\"\r\n"
+set breakpoint_re "=(?:breakpoint-created|breakpoint-deleted)\[^\n\]+\"\r\n"
 
 #
 # mi_gdb_exit -- exit the GDB, killing the target program if necessary
@@ -576,7 +576,7 @@ proc mi_gdb_test { args } {
     global verbose
     global mi_gdb_prompt
     global GDB expect_out
-    global inferior_exited_re
+    global inferior_exited_re thread_selected_re breakpoint_re
     upvar timeout timeout
 
     set command [lindex $args 0]
@@ -668,7 +668,7 @@ proc mi_gdb_test { args } {
 	    gdb_start
 	    set result -1
 	}
-	 -re "^($string_regex\[\r\n\]+)?($pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)" {
+	 -re "^(?:$thread_selected_re|$breakpoint_re)*($string_regex\[\r\n\]+)?($pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)" {
 	    # At this point, $expect_out(1,string) is the MI input command.
 	    # and $expect_out(2,string) is the MI output command.
 	    # If $expect_out(1,string) is "", then there was no MI input command here.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2011-11-02 17:31 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-27 10:16 [patch] testsuite: MI: racy results in async mode (PR testsuite/12649) Jan Kratochvil
2011-10-27 16:49 ` Tom Tromey
2011-10-28  8:51   ` [commit] " Jan Kratochvil
2011-10-29 10:36     ` [patch] testsuite: MI: racy results in async mode #2 Jan Kratochvil
2011-10-29 12:10       ` Marek Polacek
2011-10-29 12:15         ` Marek Polacek
2011-10-29 15:09           ` Jan Kratochvil
2011-10-29 16:01             ` Marek Polacek
2011-11-01 16:20       ` Tom Tromey
2011-11-01 20:01         ` [commit] " Jan Kratochvil
2011-11-01 16:26       ` Marek Polacek
2011-11-01 15:40 ` [patch] testsuite: MI: racy results in async mode (PR testsuite/12649) Doug Evans
2011-11-01 16:26   ` Jan Kratochvil
2011-11-01 18:55   ` Tom Tromey
2011-11-01 22:46     ` Doug Evans
2011-11-02 17:31       ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox