Update copyright year range in header of all files managed by GDB
[binutils-gdb.git] / gdb / testsuite / gdb.base / subst.exp
blobad5ebb3e864fd293c6225e2ca08c8e26b59f8f06
1 # Copyright 2006-2023 Free Software Foundation, Inc.
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.
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.
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/>.
16 gdb_exit
17 gdb_start
18 gdb_reinitialize_dir $srcdir/$subdir
20 # Do a bunch of testing of the set/unset/show substitute-path
21 # commands that do not require the presence of an executable.
23 gdb_test_no_output "set confirm off" \
24          "deactivate GDB's confirmation interface"
26 # Clear any substitution rules that are available by default due
27 # to GDB being configured with --with-relocated-sources.
29 gdb_test_no_output "unset substitute-path" \
30          "remove default substitution rules"
32 gdb_test "show substitute-path" \
33          "List of all source path substitution rules:" \
34          "show substitute-path, no rule entered yet"
36 gdb_test "show substitute-path from" \
37          "Source path substitution rule matching `from':" \
38          "show substitute-path from, no rule entered yet"
40 gdb_test "show substitute-path too many" \
41          "Too many arguments in command" \
42          "show substitute-path, too many arguments"
44 gdb_test "unset substitute-path from" \
45          "No substitution rule defined for `from'" \
46          "unset substitute-path from, no rule entered yet"
48 gdb_test_no_output "unset substitute-path" \
49          "unset substitute-path, no rule entered yet"
51 gdb_test "unset substitute-path from" \
52          "No substitution rule defined for `from'" \
53          "unset substitute-path from, after unset substitute-path"
55 gdb_test "unset substitute-path from to" \
56          "Incorrect usage, too many arguments in command" \
57          "unset substitute-path, too many arguments"
59 gdb_test "set substitute-path too many arguments" \
60          "Incorrect usage, too many arguments in command" \
61          "set substitute-path, too many arguments"
63 gdb_test "set substitute-path missing" \
64          "Incorrect usage, too few arguments in command" \
65          "set substitute-path, too few arguments"
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"
71 gdb_test_no_output "set substitute-path from to" \
72          "add from -> to substitution rule"
74 gdb_test_no_output "set substitute-path from1 to1/" \
75          "add from1 -> to1 substitution rule"
77 gdb_test_no_output "set substitute-path source destination" \
78          "add source -> destination substitution rule"
80 gdb_test_no_output "set substitute-path depuis/ vers" \
81          "add depuis -> vers substitution rule"
83 gdb_test_no_output "set substitute-path empty ''" \
84          "add substitution rule to empty string"
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"
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"
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"
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"
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"
106 gdb_test "show substitute-path garbage" \
107          "Source path substitution rule matching `garbage':" \
108          "show substitute-path garbage, after all paths added"
110 gdb_test_no_output "unset substitute-path from" \
111          "unset substitute-path from"
113 gdb_test "show substitute-path from" \
114          "Source path substitution rule matching `from':" \
115          "show substitute-path from, after unsetting it"
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"
121 gdb_test "unset substitute-path from" \
122          "No substitution rule defined for `from'" \
123          "unset substitute-path from after the rule was removed"
125 gdb_test_no_output "unset substitute-path depuis" \
126          "unset substitute-path depuis (middle of list)"
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"
132 gdb_test_no_output "unset substitute-path empty" \
133          "unset substitute-path empty (end of list)"
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"
139 gdb_test_no_output "unset substitute-path" \
140          "remove all remaining substitution rules"
142 gdb_test "show substitute-path" \
143          "List of all source path substitution rules:" \
144          "show substitute-path after all remaining rules removed"