diff options
author | Jim Blandy <jimb@codesourcery.com> | 2007-12-31 21:34:48 +0000 |
---|---|---|
committer | Jim Blandy <jimb@codesourcery.com> | 2007-12-31 21:34:48 +0000 |
commit | ef682c56efa7dd8b4b7935cc09359c053c30cf10 (patch) | |
tree | 53773859684152c1a5cb8f48991ce46d4e159fc5 | |
parent | 992824d50ed0d22dfa78494b8aa5dff0d6330a66 (diff) | |
download | fsf-binutils-gdb-ef682c56efa7dd8b4b7935cc09359c053c30cf10.zip fsf-binutils-gdb-ef682c56efa7dd8b4b7935cc09359c053c30cf10.tar.gz fsf-binutils-gdb-ef682c56efa7dd8b4b7935cc09359c053c30cf10.tar.bz2 |
* gdb.base/multi-forks.exp: Consume all output from child
processes before proceeding to next test.
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/multi-forks.exp | 44 |
2 files changed, 45 insertions, 4 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6a4842b..6e2f8dbf 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-12-31 Jim Blandy <jimb@codesourcery.com> + + * gdb.base/multi-forks.exp: Consume all output from child + processes before proceeding to next test. + 2007-12-29 Jim Blandy <jimb@codesourcery.com> * configure: Regenerated. diff --git a/gdb/testsuite/gdb.base/multi-forks.exp b/gdb/testsuite/gdb.base/multi-forks.exp index b607d43..d7aa217 100644 --- a/gdb/testsuite/gdb.base/multi-forks.exp +++ b/gdb/testsuite/gdb.base/multi-forks.exp @@ -88,10 +88,46 @@ gdb_test "break $exit_bp_loc" "Breakpoint.* at .*" "Break at exit" 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" \ |