Blame SOURCES/gdb-6.5-bz243845-stale-testing-zombie-test.patch

f9426a
diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.base/tracefork-zombie.exp gdb-6.3/gdb/testsuite/gdb.base/tracefork-zombie.exp
f9426a
--- gdb-6.3-unpatched/gdb/testsuite/gdb.base/tracefork-zombie.exp	1969-12-31 19:00:00.000000000 -0500
f9426a
+++ gdb-6.3/gdb/testsuite/gdb.base/tracefork-zombie.exp	2007-07-31 13:04:12.000000000 -0400
f9426a
@@ -0,0 +1,75 @@
f9426a
+# Copyright 2007 Free Software Foundation, Inc.
f9426a
+
f9426a
+# This program is free software; you can redistribute it and/or modify
f9426a
+# it under the terms of the GNU General Public License as published by
f9426a
+# the Free Software Foundation; either version 2 of the License, or
f9426a
+# (at your option) any later version.
f9426a
+# 
f9426a
+# This program is distributed in the hope that it will be useful,
f9426a
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
f9426a
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f9426a
+# GNU General Public License for more details.
f9426a
+# 
f9426a
+# You should have received a copy of the GNU General Public License
f9426a
+# along with this program; if not, write to the Free Software
f9426a
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
f9426a
+
f9426a
+# are we on a target board
f9426a
+if [is_remote target] then {
f9426a
+    return 0
f9426a
+}
f9426a
+
f9426a
+# Start the program running and then wait for a bit, to be sure
f9426a
+# that it can be attached to.
f9426a
+
f9426a
+gdb_exit
f9426a
+gdb_start
f9426a
+gdb_load sleep
f9426a
+
f9426a
+set gdb_pid [exp_pid -i [board_info host fileid]]
f9426a
+set test "identified the child GDB"
f9426a
+if {$gdb_pid != "" && $gdb_pid > 0} {
f9426a
+    pass $test
f9426a
+    verbose -log "Child GDB PID $gdb_pid"
f9426a
+} else {
f9426a
+    fail $test
f9426a
+}
f9426a
+
f9426a
+set testpid [eval exec sleep 10 &]
f9426a
+exec sleep 2
f9426a
+
f9426a
+set test "attach"
f9426a
+gdb_test_multiple "attach $testpid" "$test" {
f9426a
+    -re "Attaching to program.*`?.*'?, process $testpid..*$gdb_prompt $" {
f9426a
+	pass "$test"
f9426a
+    }
f9426a
+    -re "Attaching to program.*`?.*\.exe'?, process $testpid.*\[Switching to thread $testpid\..*\].*$gdb_prompt $" {
f9426a
+	# Response expected on Cygwin
f9426a
+	pass "$test"
f9426a
+    }
f9426a
+}
f9426a
+
f9426a
+# Some time to let GDB spawn its testing child.
f9426a
+exec sleep 2
f9426a
+
f9426a
+set found none
f9426a
+foreach procpid [glob -directory /proc -type d {[0-9]*}] {
f9426a
+    if {[catch {open $procpid/status} statusfi]} {
f9426a
+	continue
f9426a
+    }
f9426a
+    set status [read $statusfi]
f9426a
+    close $statusfi
f9426a
+    if {1
f9426a
+         && [regexp -line {^Name:\tgdb$} $status]
f9426a
+         && [regexp -line {^PPid:\t1$} $status]
f9426a
+         && [regexp -line "^TracerPid:\t$gdb_pid$" $status]} {
f9426a
+	set found $procpid
f9426a
+	verbose -log "Found linux_test_for_tracefork zombie PID $procpid"
f9426a
+    }
f9426a
+}
f9426a
+set test "linux_test_for_tracefork leaves no zombie"
f9426a
+if {$found eq {none}} {
f9426a
+    pass $test
f9426a
+} else {
f9426a
+    fail $test
f9426a
+}