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