From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9628 invoked by alias); 27 Oct 2011 10:16:07 -0000 Received: (qmail 9612 invoked by uid 22791); 27 Oct 2011 10:16:06 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Oct 2011 10:15:48 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9RAFlbw025049 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 27 Oct 2011 06:15:48 -0400 Received: from host1.jankratochvil.net (ovpn-116-23.ams2.redhat.com [10.36.116.23]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p9RAFjnG001086 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 27 Oct 2011 06:15:47 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p9RAFjb0021737; Thu, 27 Oct 2011 12:15:45 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p9RAFi3T021732; Thu, 27 Oct 2011 12:15:44 +0200 Date: Thu, 27 Oct 2011 10:16:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Cc: Marek Polacek Subject: [patch] testsuite: MI: racy results in async mode (PR testsuite/12649) Message-ID: <20111027101544.GA5288@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00720.txt.bz2 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 * 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.