1 # Copyright 2006-2014 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/>.
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, no rule entered yet"
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 garbage" \
99 "Source path substitution rule matching `garbage':" \
100 "show substitute-path garbage, after all paths added"
102 gdb_test_no_output "unset substitute-path from" \
103 "unset substitute-path from"
105 gdb_test "show substitute-path from" \
106 "Source path substitution rule matching `from':" \
107 "show substitute-path from, after unsetting it"
109 gdb_test "show substitute-path" \
110 "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`depuis' -> `vers'.\r\n +`empty' -> `'." \
111 "show substitute-path after from rule removed"
113 gdb_test "unset substitute-path from" \
114 "No substitution rule defined for `from'" \
115 "unset substitute-path from after the rule was removed"
117 gdb_test_no_output "unset substitute-path depuis" \
118 "unset substitute-path depuis (middle of list)"
120 gdb_test "show substitute-path" \
121 "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`empty' -> `'." \
122 "show substitute-path after depuis rule removed"
124 gdb_test_no_output "unset substitute-path empty" \
125 "unset substitute-path empty (end of list)"
127 gdb_test "show substitute-path" \
128 "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'." \
129 "show substitute-path after empty rule removed"
131 gdb_test_no_output "unset substitute-path" \
132 "remove all remaining substitution rules"
134 gdb_test "show substitute-path" \
135 "List of all source path substitution rules:" \
136 "show substitute-path after all remaining rules removed"