binutils-gdb/gdb/testsuite/gdb.threads/create-fail.exp

54 lines
1.7 KiB
Plaintext

# Copyright (C) 2012-2014 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 3 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, see <http://www.gnu.org/licenses/>.
# On GNU/Linux, a creating a thread bound to an unexisting cpu spawns
# the clone child thread for a bit, which is then immediately
# cancelled. The spawned child may trigger a dlopen (for libgcc_s)
# while being cancelled, which results in a trap being reported to
# GDB, for a thread that libthread_db considers to be TD_THR_ZOMBIE.
# Make sure we handle that scenario properly.
standard_testfile
set executable ${testfile}
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
return -1
}
set iterations 10
for {set i 1} {$i <= $iterations} {incr i} {
with_test_prefix "iteration $i" {
clean_restart ${executable}
if ![runto_main] {
return -1
}
set test "run till end"
gdb_test_multiple "continue" "$test" {
-re "exited with code 01.*$gdb_prompt $" {
pass "$test"
}
-re "exited with code 02.*$gdb_prompt $" {
unsupported "$test (too many CPUs for test?)"
}
-re "exited normally.*$gdb_prompt $" {
pass "$test"
}
}
}
}