]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/subst.exp
14dece9a63dd6bf5c51063f313a42add38a9ec26
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / subst.exp
1 # Copyright 2006-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 gdb_exit
17 gdb_start
18 gdb_reinitialize_dir $srcdir/$subdir
19
20 # Do a bunch of testing of the set/unset/show substitute-path
21 # commands that do not require the presence of an executable.
22
23 gdb_test_no_output "set confirm off" \
24 "deactivate GDB's confirmation interface"
25
26 # Clear any substitution rules that are available by default due
27 # to GDB being configured with --with-relocated-sources.
28
29 gdb_test_no_output "unset substitute-path" \
30 "remove default substitution rules"
31
32 gdb_test "show substitute-path" \
33 "List of all source path substitution rules:" \
34 "show substitute-path, no rule entered yet"
35
36 gdb_test "show substitute-path from" \
37 "Source path substitution rule matching `from':" \
38 "show substitute-path from, no rule entered yet"
39
40 gdb_test "show substitute-path too many" \
41 "Too many arguments in command" \
42 "show substitute-path, too many arguments"
43
44 gdb_test "unset substitute-path from" \
45 "No substitution rule defined for `from'" \
46 "unset substitute-path from, no rule entered yet"
47
48 gdb_test_no_output "unset substitute-path" \
49 "unset substitute-path, no rule entered yet"
50
51 gdb_test "unset substitute-path from" \
52 "No substitution rule defined for `from'" \
53 "unset substitute-path from, no rule entered yet"
54
55 gdb_test "unset substitute-path from to" \
56 "Incorrect usage, too many arguments in command" \
57 "unset substitute-path, too many arguments"
58
59 gdb_test "set substitute-path too many arguments" \
60 "Incorrect usage, too many arguments in command" \
61 "set substitute-path, too many arguments"
62
63 gdb_test "set substitute-path missing" \
64 "Incorrect usage, too few arguments in command" \
65 "set substitute-path, too few arguments"
66
67 gdb_test "set substitute-path '' to" \
68 "First argument must be at least one character long" \
69 "set substitute-path, first argument is empty string"
70
71 gdb_test_no_output "set substitute-path from to" \
72 "add from -> to substitution rule"
73
74 gdb_test_no_output "set substitute-path from1 to1/" \
75 "add from1 -> to1 substitution rule"
76
77 gdb_test_no_output "set substitute-path source destination" \
78 "add source -> destination substitution rule"
79
80 gdb_test_no_output "set substitute-path depuis/ vers" \
81 "add depuis -> vers substitution rule"
82
83 gdb_test_no_output "set substitute-path empty ''" \
84 "add substitution rule to empty string"
85
86 gdb_test "show substitute-path" \
87 "List of all source path substitution rules:\r\n +`from' -> `to'.\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`depuis' -> `vers'.\r\n +`empty' -> `'." \
88 "show substitute-path after all paths added"
89
90 gdb_test "show substitute-path from" \
91 "Source path substitution rule matching `from':\r\n +`from' -> `to'." \
92 "show substitute-path from, after all paths added"
93
94 gdb_test "show substitute-path depuis" \
95 "Source path substitution rule matching `depuis':\r\n +`depuis' -> `vers'." \
96 "show substitute-path depuis, after all paths added"
97
98 gdb_test "show substitute-path from/path" \
99 "Source path substitution rule matching `from/path':\r\n +`from' -> `to'." \
100 "show substitute-path from/path, after all paths added"
101
102 gdb_test "show substitute-path from_a_bad_path" \
103 "Source path substitution rule matching `from_a_bad_path':" \
104 "show substitute-path from_a_bad_path, after all paths added"
105
106 gdb_test "show substitute-path garbage" \
107 "Source path substitution rule matching `garbage':" \
108 "show substitute-path garbage, after all paths added"
109
110 gdb_test_no_output "unset substitute-path from" \
111 "unset substitute-path from"
112
113 gdb_test "show substitute-path from" \
114 "Source path substitution rule matching `from':" \
115 "show substitute-path from, after unsetting it"
116
117 gdb_test "show substitute-path" \
118 "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`depuis' -> `vers'.\r\n +`empty' -> `'." \
119 "show substitute-path after from rule removed"
120
121 gdb_test "unset substitute-path from" \
122 "No substitution rule defined for `from'" \
123 "unset substitute-path from after the rule was removed"
124
125 gdb_test_no_output "unset substitute-path depuis" \
126 "unset substitute-path depuis (middle of list)"
127
128 gdb_test "show substitute-path" \
129 "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`empty' -> `'." \
130 "show substitute-path after depuis rule removed"
131
132 gdb_test_no_output "unset substitute-path empty" \
133 "unset substitute-path empty (end of list)"
134
135 gdb_test "show substitute-path" \
136 "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'." \
137 "show substitute-path after empty rule removed"
138
139 gdb_test_no_output "unset substitute-path" \
140 "remove all remaining substitution rules"
141
142 gdb_test "show substitute-path" \
143 "List of all source path substitution rules:" \
144 "show substitute-path after all remaining rules removed"
145
146