* source.c (is_regular_file): New arg errno_ptr.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / bad-file.exp
1 # Copyright 2015 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 # We watch for specific text for errno, so only test on systems we have
19 # confidence in the error text.
20
21 if { ! [ishost "*-*-linux*"] } {
22 return 0
23 }
24
25 # There is no such file, but we still use the normal mechanism to pick
26 # its name and path.
27 standard_testfile
28
29 gdb_exit
30 gdb_start
31
32 set test "non-existent file"
33 set bad_file $testfile
34 remote_file host delete $bad_file
35 gdb_test_multiple "file $bad_file" "$test" {
36 -re "No such file or directory.\[\r\n\]+$gdb_prompt $" {
37 pass $test
38 }
39 }
40
41 set test "directory"
42 set bad_file [standard_output_file {}]
43 remote_exec host "mkdir -p $bad_file"
44 gdb_test_multiple "file $bad_file" "$test" {
45 -re "Is a directory.\[\r\n\]+$gdb_prompt $" {
46 pass $test
47 }
48 }
49
50 set test "neither file nor directory"
51 set bad_file "/dev/null"
52 gdb_test_multiple "file $bad_file" "$test" {
53 -re "Invalid argument.\[\r\n\]+$gdb_prompt $" {
54 pass $test
55 }
56 }
This page took 0.03652 seconds and 4 git commands to generate.