Commit | Line | Data |
---|---|---|
618f726f | 1 | # Copyright 2006-2016 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 | |
dd920c33 JB |
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 | ||
27d3a1a2 | 23 | gdb_test_no_output "set confirm off" \ |
dd920c33 JB |
24 | "deactivate GDB's confirmation interface" |
25 | ||
d69cace4 LM |
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 | ||
dd920c33 JB |
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 | ||
27d3a1a2 | 48 | gdb_test_no_output "unset substitute-path" \ |
dd920c33 JB |
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 | ||
27d3a1a2 | 71 | gdb_test_no_output "set substitute-path from to" \ |
dd920c33 JB |
72 | "add from -> to substitution rule" |
73 | ||
27d3a1a2 | 74 | gdb_test_no_output "set substitute-path from1 to1/" \ |
dd920c33 JB |
75 | "add from1 -> to1 substitution rule" |
76 | ||
27d3a1a2 | 77 | gdb_test_no_output "set substitute-path source destination" \ |
dd920c33 JB |
78 | "add source -> destination substitution rule" |
79 | ||
27d3a1a2 | 80 | gdb_test_no_output "set substitute-path depuis/ vers" \ |
dd920c33 JB |
81 | "add depuis -> vers substitution rule" |
82 | ||
27d3a1a2 | 83 | gdb_test_no_output "set substitute-path empty ''" \ |
dd920c33 JB |
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 | ||
1e2ccb61 BM |
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 | ||
dd920c33 JB |
106 | gdb_test "show substitute-path garbage" \ |
107 | "Source path substitution rule matching `garbage':" \ | |
108 | "show substitute-path garbage, after all paths added" | |
109 | ||
27d3a1a2 | 110 | gdb_test_no_output "unset substitute-path from" \ |
dd920c33 JB |
111 | "unset substitute-path from" |
112 | ||
113 | gdb_test "show substitute-path from" \ | |
114 | "Source path substitution rule matching `from':" \ | |
f629457d | 115 | "show substitute-path from, after unsetting it" |
dd920c33 JB |
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 | ||
27d3a1a2 | 125 | gdb_test_no_output "unset substitute-path depuis" \ |
dd920c33 JB |
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 | ||
27d3a1a2 | 132 | gdb_test_no_output "unset substitute-path empty" \ |
dd920c33 JB |
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 | ||
27d3a1a2 | 139 | gdb_test_no_output "unset substitute-path" \ |
dd920c33 JB |
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 |