]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/bad-file.exp
Update copyright year range in all GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / bad-file.exp
1 # Copyright 2016-2020 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>. */
15
16 # Test passing bad files to gdb. PR symtab/17911
17
18 # Note: While we test for specific text in error messages,
19 # thus perhaps making the test host specific, if your host
20 # print different text then the plan is to update the expected text
21 # instead of making this test linux-only or some such.
22
23 # There is no such file, but we still use the normal mechanism to pick
24 # its name and path.
25 standard_testfile
26
27 gdb_exit
28 gdb_start
29
30 set test "non-existent file"
31 set bad_file $testfile
32 remote_file host delete $bad_file
33 gdb_test_multiple "file $bad_file" "$test" {
34 -re "No such file or directory.\[\r\n\]+$gdb_prompt $" {
35 pass $test
36 }
37 }
38
39 set test "directory"
40 set bad_file [standard_output_file {}]
41 remote_exec host "mkdir -p $bad_file"
42 gdb_test_multiple "file $bad_file" "$test" {
43 -re "Is a directory.\[\r\n\]+$gdb_prompt $" {
44 pass $test
45 }
46 }
47
48 set test "neither file nor directory"
49 set bad_file "/dev/null"
50 gdb_test_multiple "file $bad_file" "$test" {
51 -re "Invalid argument.\[\r\n\]+$gdb_prompt $" {
52 pass $test
53 }
54 }