This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] testsuite: MI: racy results in async mode #2
On Fri, 28 Oct 2011 10:32:56 +0200, Jan Kratochvil wrote:
> > Jan> 2011-10-27 Jan Kratochvil <jan.kratochvil@redhat.com>
> > Jan> * lib/mi-support.exp (breakpoint_re): Suppress match reporting.
> > Jan> (mi_gdb_test): Import globals thread_selected_re
> > Jan> and breakpoint_re. Expect them optionally at the regex start.
[...]
> Checked in:
> http://sourceware.org/ml/gdb-cvs/2011-10/msg00202.html
Unfortunately it still does not work (but it is no longer reproducible by the
testsuite/12649 "read1" way).
-*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x080485fd",func="main",args=[{name="argc",value="1"},{name="argv",value="0xffffd1e4"}],file="gdb/testsuite/gdb.mi/non-stop.c",fullname="gdb/testsuite/gdb.mi/non-stop.c",line="86"},thread-id="1",stopped-threads=["1"],core="5"^M
+*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x080485fd",func="main",args=[{name="argc",value="1"},{name="argv",value="0xffffd1c4"}],file="gdb/testsuite/gdb.mi/non-stop.c",fullname="gdb/testsuite/gdb.mi/non-stop.c",line="86"},thread-id="1",stopped-threads=["1"],core="0"^M
+=breakpoint-deleted,id="1"^M
PASS: gdb.mi/mi-nonstop.exp: mi runto main
Expecting: 222\^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr=".*",func="break_at_me",file=".*",fullname=".*",line=".*",times="0",original-location=".*"}
Expecting: ^(222-break-insert break_at_me[^M
]+)?(222\^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr=".*",func="break_at_me",file=".*",fullname=".*",line=".*",times="0",original-location=".*"}[^M
]+[(]gdb[)] ^M
[ ]*)
222-break-insert break_at_me^M
-=breakpoint-deleted,id="1"^M
222^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x08048537",func="break_at_me",file="gdb/testsuite/gdb.mi/non-stop.c",fullname="gdb/testsuite/gdb.mi/non-stop.c",line="41",times="0",original-location="break_at_me"}^M
(gdb) ^M
-FAIL: gdb.mi/mi-nonstop.exp: breakpoint at marker
+PASS: gdb.mi/mi-nonstop.exp: breakpoint at marker
Therefore proposing the attached way.
No regressions on {x86_64,x86_64-m32,i686}-fedora16pre-linux-gnu and with gdbserver.
Thanks,
Jan
gdb/testsuite/
2011-10-29 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix racy FAILs.
* lib/mi-support.exp (mi_gdb_test): Replace thread_selected_re and
breakpoint_re globals import by async. Set string_regex to .* for
async. Remove the optional thread_selected_re and breakpoint_re
globals expectations.
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -576,7 +576,7 @@ proc mi_gdb_test { args } {
global verbose
global mi_gdb_prompt
global GDB expect_out
- global inferior_exited_re thread_selected_re breakpoint_re
+ global inferior_exited_re async
upvar timeout timeout
set command [lindex $args 0]
@@ -651,6 +651,11 @@ proc mi_gdb_test { args } {
set tmt 60;
}
}
+ if {$async} {
+ # With $prompt_re "" there may come arbitrary asynchronous response
+ # from the previous command, before or after $string_regex.
+ set string_regex ".*"
+ }
verbose -log "Expecting: ^($string_regex\[\r\n\]+)?($pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)"
gdb_expect $tmt {
-re "\\*\\*\\* DOSEXIT code.*" {
@@ -668,7 +673,7 @@ proc mi_gdb_test { args } {
gdb_start
set result -1
}
- -re "^(?:$thread_selected_re|$breakpoint_re)*($string_regex\[\r\n\]+)?($pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)" {
+ -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.