Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Cc: Marek Polacek <mpolacek@redhat.com>
Subject: [patch] testsuite: MI: racy results in async mode (PR testsuite/12649)
Date: Thu, 27 Oct 2011 10:16:00 -0000	[thread overview]
Message-ID: <20111027101544.GA5288@host1.jankratochvil.net> (raw)

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.


             reply	other threads:[~2011-10-27 10:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-27 10:16 Jan Kratochvil [this message]
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

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=20111027101544.GA5288@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mpolacek@redhat.com \
    /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