binutils-gdb/gdb/testsuite/gdb.server/non-existing-program.exp

68 lines
1.8 KiB
Plaintext
Raw Normal View History

# This testcase is part of GDB, the GNU debugger.
# Copyright 2015 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/>.
# Test starting gdbserver passing it the name of a non-existing
# program.
load_lib gdbserver-support.exp
standard_testfile
if { [skip_gdbserver_tests] } {
return 0
}
set gdbserver [find_gdbserver]
if { $gdbserver == "" } {
fail "could not find gdbserver"
return
}
# Fire off gdbserver. The port doesn't really matter, gdbserver tries
# to spawn the program before opening the connection.
set spawn_id [remote_spawn target "$gdbserver stdio non-existing-program"]
set msg "gdbserver exits cleanly"
set saw_exiting 0
expect {
# This is what we get on ptrace-based targets.
-re "stdin/stdout redirected.*No program to debug\r\nExiting\r\n$" {
set saw_exiting 1
exp_continue
}
# This is what we get on Windows.
-re "Error creating process\r\n\r\nExiting\r\n$" {
set saw_exiting 1
exp_continue
}
-re "A problem internal to GDBserver has been detected" {
fail "$msg (GDBserver internal error)"
wait
}
eof {
gdb_assert $saw_exiting $msg
wait
}
timeout {
fail "$msg (timeout)"
}
}
Fix sequential gdb test runs Sequential test runs are stopping prematurely like this: $ make check RUNTESTFLAGS="non-existing-program.exp server-exec-info.exp" Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.server/non-existing-program.exp ... Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.server/server-exec-info.exp ... can not find channel named "exp6" while executing "match_max [match_max -d]" (procedure "default_gdb_init" line 26) invoked from within "default_gdb_init $test_file_name" (procedure "gdb_init" line 83) invoked from within "${tool}_init $test_file_name" (procedure "runtest" line 18) invoked from within "runtest $test_name" ("foreach" body line 42) invoked from within ... make[2]: *** [check-single] Error 1 make[2]: Leaving directory `/home/pedro/gdb/mygit/build/gdb/testsuite' make[1]: *** [check] Error 2 make[1]: Leaving directory `/home/pedro/gdb/mygit/build/gdb/testsuite' make: *** [check] Error 2 default_gdb_init has this: # Unlike most tests, we have a small number of tests that generate # a very large amount of output. We therefore increase the expect # buffer size to be able to contain the entire test output. This # is especially needed by gdb.base/info-macros.exp. match_max -d 65536 # Also set this value for the currently running GDB. match_max [match_max -d] It's the second match_max that is erroring. As that call does not specify an explicit channel name with -i, expect defaults to $spawn_id, which is pointing at a channel that is already gone. (If the spawn_id variable is not set, match_max defaults to $user_spawn_id / stdin/out). gdb/testsuite/ChangeLog: 2015-05-08 Pedro Alves <palves@redhat.com> * gdb.server/non-existing-program.exp: Unset spawn_id.
2015-05-08 19:06:46 +02:00
# expect defaults to spawn_id in many places. Avoid confusing any
# following code.
unset spawn_id