1 # Copyright 2006, 2007 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 2 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, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24 gdb_reinitialize_dir $srcdir/$subdir
26 # Do a bunch of testing of the set/unset/show substitute-path
27 # commands that do not require the presence of an executable.
29 gdb_test "set confirm off" \
31 "deactivate GDB's confirmation interface"
33 gdb_test "show substitute-path" \
34 "List of all source path substitution rules:" \
35 "show substitute-path, no rule entered yet"
37 gdb_test "show substitute-path from" \
38 "Source path substitution rule matching `from':" \
39 "show substitute-path from, no rule entered yet"
41 gdb_test "show substitute-path too many" \
42 "Too many arguments in command" \
43 "show substitute-path, too many arguments"
45 gdb_test "unset substitute-path from" \
46 "No substitution rule defined for `from'" \
47 "unset substitute-path from, no rule entered yet"
49 gdb_test "unset substitute-path" \
51 "unset substitute-path, no rule entered yet"
53 gdb_test "unset substitute-path from" \
54 "No substitution rule defined for `from'" \
55 "unset substitute-path from, no rule entered yet"
57 gdb_test "unset substitute-path from to" \
58 "Incorrect usage, too many arguments in command" \
59 "unset substitute-path, too many arguments"
61 gdb_test "set substitute-path too many arguments" \
62 "Incorrect usage, too many arguments in command" \
63 "set substitute-path, too many arguments"
65 gdb_test "set substitute-path missing" \
66 "Incorrect usage, too few arguments in command" \
67 "set substitute-path, too few arguments"
69 gdb_test "set substitute-path '' to" \
70 "First argument must be at least one character long" \
71 "set substitute-path, first argument is empty string"
73 gdb_test "set substitute-path from to" \
75 "add from -> to substitution rule"
77 gdb_test "set substitute-path from1 to1/" \
79 "add from1 -> to1 substitution rule"
81 gdb_test "set substitute-path source destination" \
83 "add source -> destination substitution rule"
85 gdb_test "set substitute-path depuis/ vers" \
87 "add depuis -> vers substitution rule"
89 gdb_test "set substitute-path empty ''" \
91 "add substitution rule to empty string"
93 gdb_test "show substitute-path" \
94 "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' -> `'." \
95 "show substitute-path after all paths added"
97 gdb_test "show substitute-path from" \
98 "Source path substitution rule matching `from':\r\n +`from' -> `to'." \
99 "show substitute-path from, after all paths added"
101 gdb_test "show substitute-path depuis" \
102 "Source path substitution rule matching `depuis':\r\n +`depuis' -> `vers'." \
103 "show substitute-path depuis, after all paths added"
105 gdb_test "show substitute-path garbage" \
106 "Source path substitution rule matching `garbage':" \
107 "show substitute-path garbage, after all paths added"
109 gdb_test "unset substitute-path from" \
111 "unset substitute-path from"
113 gdb_test "show substitute-path from" \
114 "Source path substitution rule matching `from':" \
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 "unset substitute-path depuis" \
127 "unset substitute-path depuis (middle of list)"
129 gdb_test "show substitute-path" \
130 "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`empty' -> `'." \
131 "show substitute-path after depuis rule removed"
133 gdb_test "unset substitute-path empty" \
135 "unset substitute-path empty (end of list)"
137 gdb_test "show substitute-path" \
138 "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'." \
139 "show substitute-path after empty rule removed"
141 gdb_test "unset substitute-path" \
143 "remove all remaining substitution rules"
145 gdb_test "show substitute-path" \
146 "List of all source path substitution rules:" \
147 "show substitute-path after all remaining rules removed"