* RFA: Fix multi-fork.exp for good
@ 2007-12-29 14:02 Jim Blandy
2007-12-30 4:34 ` Daniel Jacobowitz
0 siblings, 1 reply; 2+ messages in thread
From: Jim Blandy @ 2007-12-29 14:02 UTC (permalink / raw)
To: gdb-patches
Or at least, I hope so. I was getting occasional timeouts from
interactions after the follow-parent tests on loaded machines. Set a
few windows doing 'while true; do :; done' and give it a try.
gdb/testsuite/ChangeLog:
2007-12-29 Jim Blandy <jimb@codesourcery.com>
* gdb.base/multi-forks.exp: Consume all output from child
processes before proceeding to next test.
diff -r 37bb176d50e5 gdb/testsuite/gdb.base/multi-forks.exp
--- a/gdb/testsuite/gdb.base/multi-forks.exp Fri Dec 28 09:20:36 2007 -0800
+++ b/gdb/testsuite/gdb.base/multi-forks.exp Sat Dec 29 04:55:56 2007 -0800
@@ -88,10 +88,46 @@ gdb_test "set follow parent" "" ""
gdb_test "set follow parent" "" ""
send_gdb "continue\n"
-gdb_expect {
- -re ".*Break.* main .*$gdb_prompt.*$" {}
- -re ".*$gdb_prompt $" {fail "run to exit 2"}
- default {fail "run to exit 2 (timeout)"}
+
+# The output from the child processes can be interleaved arbitrarily
+# with the output from GDB and the parent process. If we don't
+# consume it all now, it can confuse later interactions.
+set seen_done 0
+set seen_break 0
+set seen_prompt 0
+set seen_timeout 0
+while { ($seen_done < 16 || ! $seen_prompt) && ! $seen_timeout } {
+ # We don't know what order the interesting things will arrive in.
+ # Using a pattern of the form 'x|y|z' instead of -re x ... -re y
+ # ... -re z ensures that expect always chooses the match that
+ # occurs leftmost in the input, and not the pattern appearing
+ # first in the script that occurs anywhere in the input, so that
+ # we don't skip anything.
+ gdb_expect {
+ -re "($decimal done)|(Breakpoint)|($gdb_prompt)" {
+ if {[info exists expect_out(1,string)]} {
+ incr seen_done
+ } elseif {[info exists expect_out(2,string)]} {
+ set seen_break 1
+ } elseif {[info exists expect_out(3,string)]} {
+ set seen_prompt 1
+ }
+ array unset expect_out
+ }
+ timeout { set seen_timeout 1 }
+ }
+}
+
+if { $seen_timeout } {
+ fail "run to exit 2 (timeout)"
+} elseif { ! $seen_prompt } {
+ fail "run to exit 2 (no prompt)"
+} elseif { ! $seen_break } {
+ fail "run to exit 2 (no breakpoint hit)"
+} elseif { $seen_done != 16 } {
+ fail "run to exit 2 (missing done messages)"
+} else {
+ pass "run to exit 2"
}
gdb_test "print pids\[0\]==0 || pids\[1\]==0 || pids\[2\]==0 || pids\[3\]==0" \
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: RFA: Fix multi-fork.exp for good
2007-12-29 14:02 RFA: Fix multi-fork.exp for good Jim Blandy
@ 2007-12-30 4:34 ` Daniel Jacobowitz
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2007-12-30 4:34 UTC (permalink / raw)
To: Jim Blandy; +Cc: gdb-patches
On Sat, Dec 29, 2007 at 04:59:38AM -0800, Jim Blandy wrote:
> Or at least, I hope so. I was getting occasional timeouts from
> interactions after the follow-parent tests on loaded machines. Set a
> few windows doing 'while true; do :; done' and give it a try.
Thanks. I saw this behavior too; your patch looks good to me.
> + # We don't know what order the interesting things will arrive in.
> + # Using a pattern of the form 'x|y|z' instead of -re x ... -re y
> + # ... -re z ensures that expect always chooses the match that
> + # occurs leftmost in the input, and not the pattern appearing
> + # first in the script that occurs anywhere in the input, so that
> + # we don't skip anything.
Cute trick!
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-12-30 4:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-29 14:02 RFA: Fix multi-fork.exp for good Jim Blandy
2007-12-30 4:34 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox