2009-07-01 Tristan Gingold <gingold@adacore.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / subst.exp
1 # Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
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
5 # the Free Software Foundation; either version 3 of the License, or
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
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 if $tracelevel {
17 strace $tracelevel
18 }
19
20 gdb_exit
21 gdb_start
22 gdb_reinitialize_dir $srcdir/$subdir
23
24 # Do a bunch of testing of the set/unset/show substitute-path
25 # commands that do not require the presence of an executable.
26
27 gdb_test "set confirm off" \
28 "" \
29 "deactivate GDB's confirmation interface"
30
31 gdb_test "show substitute-path" \
32 "List of all source path substitution rules:" \
33 "show substitute-path, no rule entered yet"
34
35 gdb_test "show substitute-path from" \
36 "Source path substitution rule matching `from':" \
37 "show substitute-path from, no rule entered yet"
38
39 gdb_test "show substitute-path too many" \
40 "Too many arguments in command" \
41 "show substitute-path, too many arguments"
42
43 gdb_test "unset substitute-path from" \
44 "No substitution rule defined for `from'" \
45 "unset substitute-path from, no rule entered yet"
46
47 gdb_test "unset substitute-path" \
48 "" \
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
71 gdb_test "set substitute-path from to" \
72 "" \
73 "add from -> to substitution rule"
74
75 gdb_test "set substitute-path from1 to1/" \
76 "" \
77 "add from1 -> to1 substitution rule"
78
79 gdb_test "set substitute-path source destination" \
80 "" \
81 "add source -> destination substitution rule"
82
83 gdb_test "set substitute-path depuis/ vers" \
84 "" \
85 "add depuis -> vers substitution rule"
86
87 gdb_test "set substitute-path empty ''" \
88 "" \
89 "add substitution rule to empty string"
90
91 gdb_test "show substitute-path" \
92 "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' -> `'." \
93 "show substitute-path after all paths added"
94
95 gdb_test "show substitute-path from" \
96 "Source path substitution rule matching `from':\r\n +`from' -> `to'." \
97 "show substitute-path from, after all paths added"
98
99 gdb_test "show substitute-path depuis" \
100 "Source path substitution rule matching `depuis':\r\n +`depuis' -> `vers'." \
101 "show substitute-path depuis, after all paths added"
102
103 gdb_test "show substitute-path garbage" \
104 "Source path substitution rule matching `garbage':" \
105 "show substitute-path garbage, after all paths added"
106
107 gdb_test "unset substitute-path from" \
108 "" \
109 "unset substitute-path from"
110
111 gdb_test "show substitute-path from" \
112 "Source path substitution rule matching `from':" \
113 ""
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
123 gdb_test "unset substitute-path depuis" \
124 "" \
125 "unset substitute-path depuis (middle of list)"
126
127 gdb_test "show substitute-path" \
128 "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`empty' -> `'." \
129 "show substitute-path after depuis rule removed"
130
131 gdb_test "unset substitute-path empty" \
132 "" \
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
139 gdb_test "unset substitute-path" \
140 "" \
141 "remove all remaining substitution rules"
142
143 gdb_test "show substitute-path" \
144 "List of all source path substitution rules:" \
145 "show substitute-path after all remaining rules removed"
146
147
This page took 0.032208 seconds and 4 git commands to generate.