]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.gdb/xfullpath.exp
812b5ea860c9a739e3ca9888fd23874bf8e9b72b
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.gdb / xfullpath.exp
1 # Copyright 2002-2016 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 # This file was written by Joel Brobecker. (brobecker@gnat.com), derived
17 # from selftest.exp, written by Rob Savoye.
18
19 load_lib selftest-support.exp
20
21 proc test_with_self {} {
22 # A file which contains a directory prefix
23 gdb_test "print gdb_realpath (\"./xfullpath.exp\")" \
24 ".\[0-9\]+ =.*\".*/xfullpath.exp\"" \
25 "A filename with ./ as the directory prefix"
26
27 # A file which contains a directory prefix
28 gdb_test "print gdb_realpath (\"../../defs.h\")" \
29 ".\[0-9\]+ =.*\".*/defs.h\"" \
30 "A filename with ../ in the directory prefix"
31
32 # A one-character filename
33 gdb_test "print gdb_realpath (\"./a\")" \
34 ".\[0-9\]+ =.*\".*/a\"" \
35 "A one-char filename in the current directory"
36
37 # A file in the root directory
38 gdb_test "print gdb_realpath (\"/root_file_which_should_exist\")" \
39 ".\[0-9\]+ =.*\"/root_file_which_should_exist\"" \
40 "A filename in the root directory"
41
42 # A file which does not have a directory prefix
43 gdb_test "print gdb_realpath (\"xfullpath.exp\")" \
44 ".\[0-9\]+ =.*\"xfullpath.exp\"" \
45 "A filename without any directory prefix"
46
47 # A one-char filename without any directory prefix
48 gdb_test "print gdb_realpath (\"a\")" \
49 ".\[0-9\]+ =.*\"a\"" \
50 "A one-char filename without any directory prefix"
51
52 # An empty filename
53 gdb_test "print gdb_realpath (\"\")" \
54 ".\[0-9\]+ =.*\"\"" \
55 "an empty filename"
56
57 return 0
58 }
59
60 do_self_tests captured_main test_with_self