diff options
Diffstat (limited to 'gdb/testsuite/gdb.hp/start-stop.exp')
-rw-r--r-- | gdb/testsuite/gdb.hp/start-stop.exp | 360 |
1 files changed, 0 insertions, 360 deletions
diff --git a/gdb/testsuite/gdb.hp/start-stop.exp b/gdb/testsuite/gdb.hp/start-stop.exp deleted file mode 100644 index 4f70f51cede..00000000000 --- a/gdb/testsuite/gdb.hp/start-stop.exp +++ /dev/null @@ -1,360 +0,0 @@ -# start_stop.exp -- Expect script to test a threaded pgm which has terminating threads -# Copyright (C) 1992 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# Comment out for now, since this test is (sometimes?) hanging on 11.0 -# -# return 0 - -# use this to debug: -# -#log_user 1 - -# Thread stuff is _slow_; prepare for long waits. -# -# Further, this test has some "null" lines designed -# to consume output from gdb that was too late to be -# matched (sequence is "gdb_test" sends; timeout and -# on to next send; result finally comes in; mismatch). -# -# The null command is 'gdb_test "p \$pc" ".*" ""' -# NOTE: this command undoes any up/down stuff! -# -proc pre_timeout {} { - global timeout - - set timeout [expr "$timeout + 100"] -} - -proc post_timeout {} { - global timeout - global oldtimeout - - set timeout $oldtimeout - gdb_test "p \$pc" ".*" "" -} - -if $tracelevel then { - strace $tracelevel -} - -if { ![istarget "hppa*-*-hpux10.30"] && ![istarget "hppa*-*-hpux11.*"] } { - verbose "HPUX thread test ignored for non-hppa or pre-HP/UX-10.30 targets." - return 0 -} - -set testfile start-stop -set srcfile ${srcdir}/${subdir}/${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} - -if [get_compiler_info ${binfile}] { - return -1 -} - -# To build the executable we need to link against the thread library. -# -# cc -Ae -g -o start-stop -lpthread start-stop.c -# -#compile "${srcfile} -Ae -g -lpthread -o ${binfile}" - -if {$gcc_compiled == 0} { - set additional_flags "additional_flags=-Ae" -} else { - set additional_flags "" -} - -if { [gdb_compile "${srcdir}/${subdir}/${testfile}.c" "${binfile}.o" object [list debug $additional_flags]] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} -remote_exec build "ld /usr/ccs/lib/crt0.o ${binfile}.o -lcl -lpthread -lc /opt/langtools/lib/end.o -o ${binfile}" - - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir - -gdb_load ${binfile} -if ![runto_main] then { - fail "Can't run to main" - return 0 -} - -set oldtimeout $timeout -#set timeout [expr "$timeout + 200"] -set oldverbose $verbose -#set verbose 40 - -gdb_test "b do_pass" ".*" "set do_pass bp" -gdb_test "c" ".*Breakpoint.*do_pass.*" "run to do_pass" - -# Should be only one thread. -# -pre_timeout -send_gdb "info thread\n" -gdb_expect { - -re ".*2 process.*$gdb_prompt $" { fail "Old code for 'thread.c'" } - -re ".*2 system thread.*1 sys.*$gdb_prompt $" { fail "Too many threads" } - -re ".*1 system thread.*$gdb_prompt $" { pass "Just one thread" } - -re ".*$gdb_prompt $" { fail "no thread info" } - timeout { fail "timeout on info thread 1" } -} -post_timeout - -# Run to a point after the thread creates (105 is just -# before the first join). -# -# The "== Thread" stuff is output from the computing threads. -# -gdb_test "b 105" ".*Breakpoint.*" "set 105 bp" - -pre_timeout -send_gdb "c\n" -gdb_expect { - -re ".*== Thread.*== Thread.*== Thread.*105.*$gdb_prompt $" { - pass "new threads created and ended" - set threads_exist 0 - } - -re ".*== Thread.*== Thread.*105.*$gdb_prompt $" { - pass "new threads created and ended" - set threads_exist 1 - } - -re ".*== Thread.*.*105.*$gdb_prompt $" { - pass "new threads created and ended" - set threads_exist 2 - } - -re ".*New thread.*New th.*New th.*105.*$gdb_prompt $" { - pass "new threads created" - set threads_exist 3 - } - -re ".*Breakpoint.*105.*$gdb_prompt $" { - set threads_exist 0 - fail "didn't see any threads" - } - -re ".*$gdb_prompt $" { - set threads_exist 0 - fail "didn't even hit bp" - } - timeout { - set threads_exist -1 - fail "timeout on continue" - } -} - -# Look at the threads again. We expect that some of -# the threads may have already finished execution. -# -send_gdb "info thread\n" -gdb_expect { - -re ".*4.*3.*2.* 1.*thread.*$gdb_prompt $" { set seen_threads 3 } - -re ".*3.*2.* 1.*thread.*$gdb_prompt $" { set seen_threads 2 } - -re ".*2.* 1.*thread.*$gdb_prompt $" { set seen_threads 1 } - -re ".* 1.*thread.*$gdb_prompt $" { set seen_threads 0 } - -re ".*$gdb_prompt $" { set seen_threads 0 } - timeout { - set seen_threads -10 - fail "timeout on second info thread" - } -} -post_timeout - -if { $seen_threads == $threads_exist } { - pass "saw all threads that existed" -} else { - if { $seen_threads > $threads_exist } { - fail "may have seen threads that didn't finish exiting yet" - } else { - fail "didn't see live threads" - } -} - -gdb_test "cle" ".*Deleted.*" "del bp at 105" - -# Check that threads are being consumed at the join call. -# We expect to join three times. If we ever see the bp at -# 111, we've gone too far. -# -gdb_test "b 106" ".*Breakpoint.*106.*" "set bp at 106" -gdb_test "b 111" ".*Breakpoint.*111.*" "set bp at 111" - -# This one is sure: we're already in the loop. -# -gdb_test "c" ".*Breakpoint.*106.*" "hit bp at 106 1st time, 2 left" - -# Did we go around the loop again? -# -send_gdb "c\n" -gdb_expect { - -re ".*Breakpoint.*111.*" { - fail "didn't join right 1" - gdb_test "cle" ".*" "" - } - -re ".*Breakpoint.*106.*" { - pass "hit bp at 106 2nd time, 1 left" - send_gdb "c\n" - gdb_expect { - -re ".*Breakpoint.*111.*" { - fail "didn't join right 2" - gdb_test "cle" ".*" "" - } - -re ".*Breakpoint.*106.*" { - pass "hit bp at 106 3rd time, 0 left" - gdb_test "cle" ".*" "" - gdb_test "c" ".*Breakpoint.*111.*" "" - gdb_test "cle" ".*" "" - } - timeout { fail "timeout going around the loop"} - } - } - timeout { fail "timeout getting to 106"} -} - -# Should only be one thread now. -# -pre_timeout -send_gdb "info thread\n" -gdb_expect { - -re ".*2 system thread.*1 sys.*$gdb_prompt $" { fail "Too many threads" } - -re ".*1 system th.*$gdb_prompt $" { pass "Just one thread" } - -re ".*$gdb_prompt $" { pass "One thread shown as no threads, ok" } - timeout { fail "timeout third info thread" } -} -post_timeout - -#============================= Begin pass 2 =========== -# -# Ok, go around again -# -gdb_test "c" ".*Breakpoint.*do_pass.*" "hit do_pass bp again 2" -gdb_test "b 105" ".*Breakpoint.*" "set 105 bp 2" - -pre_timeout -send_gdb "c\n" -gdb_expect { - -re ".*== Thread.*== Thread.*== Thread.*$gdb_prompt $" { - pass "new threads created and ended 2" - set threads_exist 0 - } - -re ".*== Thread.*== Thread.*$gdb_prompt $" { - pass "new threads created and ended 2" - set threads_exist 1 - } - -re ".*== Thread.*$gdb_prompt $" { - pass "new threads created and ended 2" - set threads_exist 2 - } - -re ".*New system thread.*New sys.*New.*105.*$gdb_prompt $" { - pass "new threads created 2" - set threads_exist 3 - } - timeout { - set threads_exist -1 - fail "timeout on continue 2" - } -} - -# Look at the threads again. We expect that some of -# the threads may have already finished execution. -# -send_gdb "info thread\n" -gdb_expect { - -re ".*4.*3.*2.* 1.*thread.*$gdb_prompt $" { set seen_threads 3 } - -re ".*3.*2.* 1.*thread.*$gdb_prompt $" { set seen_threads 2 } - -re ".*2.* 1.*thread.*$gdb_prompt $" { set seen_threads 1 } - -re ".* 1.*thread.*$gdb_prompt $" { set seen_threads 0 } - -re ".*$gdb_prompt $" { set seen_threads 0 } - timeout { - set seen_threads -10 - fail "timeout on second info thread 2" - } -} -post_timeout - -if { $seen_threads == $threads_exist } { - pass "saw all threads that existed" -} else { - if { $seen_threads > $threads_exist } { - fail "may have seen threads that didn't finish exiting yet 2" - } else { - fail "didn't see live threads 2" - } -} - -gdb_test "cle" ".*Deleted.*" "del bp at 105 2" - -# Check that threads are being consumed at the join call. -# We expect to join three times. If we ever see the bp at -# 111, we've gone too far. -# -gdb_test "b 106" ".*Breakpoint.*106.*" "set bp at 106 2" -gdb_test "b 111" ".*Breakpoint.*111.*" "set bp at 111 2" - -# This one is sure: we're already in the loop. -# -gdb_test "c" ".*Breakpoint.*106.*" "hit bp at 106 1st time, 2 left 2" - -# Did we go around the loop again? -# -send_gdb "c\n" -gdb_expect { - -re ".*Breakpoint.*111.*" { - fail "didn't join right 1, pass 2" - gdb_test "cle" ".*" "" - } - -re ".*Breakpoint.*106.*" { - pass "hit bp at 106 2nd time, 1 left, pass 2" - send_gdb "c\n" - gdb_expect { - -re ".*Breakpoint.*111.*" { - fail "didn't join right 2, pass 2" - gdb_test "cle" ".*" "" - } - -re ".*Breakpoint.*106.*" { - pass "hit bp at 106 3rd time, 0 left, pass 2" - gdb_test "cle" ".*" "" - gdb_test "c" ".*Breakpoint.*111.*" "" - gdb_test "cle" ".*" "" - } - timeout { fail "timeout going around loop, pass 2"} - } - } - timeout { fail "timeout continue to 106, pass 2"} -} - -# Should only be one thread now. -# -pre_timeout -send_gdb "info thread\n" -gdb_expect { - -re ".*2 system thread.*1 sys.*$gdb_prompt $" { fail "Too many threads, pass 2" } - -re ".*1 system thread.*$gdb_prompt $" { pass "Just one thread, pass 2" } - -re ".*$gdb_prompt $" { pass "One thread shown as no threads, ok, pass 2" } - timeout { fail "timeout last info thread, pass 2" } -} -post_timeout - -# Done! -# -gdb_exit - -set timeout $oldtimeout -set verbose $oldverbose - -# execute_anywhere "rm -f ${binfile}" -# -return 0 |