1# Copyright 2006, 2007, 2008, 2009, 2010, 2011 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
16if $tracelevel {
17    strace $tracelevel
18}
19
20gdb_exit
21gdb_start
22gdb_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
27gdb_test_no_output "set confirm off" \
28         "deactivate GDB's confirmation interface"
29
30gdb_test "show substitute-path" \
31         "List of all source path substitution rules:" \
32         "show substitute-path, no rule entered yet"
33
34gdb_test "show substitute-path from" \
35         "Source path substitution rule matching `from':" \
36         "show substitute-path from, no rule entered yet"
37
38gdb_test "show substitute-path too many" \
39         "Too many arguments in command" \
40         "show substitute-path, too many arguments"
41
42gdb_test "unset substitute-path from" \
43         "No substitution rule defined for `from'" \
44         "unset substitute-path from, no rule entered yet"
45
46gdb_test_no_output "unset substitute-path" \
47         "unset substitute-path, no rule entered yet"
48
49gdb_test "unset substitute-path from" \
50         "No substitution rule defined for `from'" \
51         "unset substitute-path from, no rule entered yet"
52
53gdb_test "unset substitute-path from to" \
54         "Incorrect usage, too many arguments in command" \
55         "unset substitute-path, too many arguments"
56
57gdb_test "set substitute-path too many arguments" \
58         "Incorrect usage, too many arguments in command" \
59         "set substitute-path, too many arguments"
60
61gdb_test "set substitute-path missing" \
62         "Incorrect usage, too few arguments in command" \
63         "set substitute-path, too few arguments"
64
65gdb_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
69gdb_test_no_output "set substitute-path from to" \
70         "add from -> to substitution rule"
71
72gdb_test_no_output "set substitute-path from1 to1/" \
73         "add from1 -> to1 substitution rule"
74
75gdb_test_no_output "set substitute-path source destination" \
76         "add source -> destination substitution rule"
77
78gdb_test_no_output "set substitute-path depuis/ vers" \
79         "add depuis -> vers substitution rule"
80
81gdb_test_no_output "set substitute-path empty ''" \
82         "add substitution rule to empty string"
83
84gdb_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
88gdb_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
92gdb_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
96gdb_test "show substitute-path garbage" \
97         "Source path substitution rule matching `garbage':" \
98         "show substitute-path garbage, after all paths added"
99
100gdb_test_no_output "unset substitute-path from" \
101         "unset substitute-path from"
102
103gdb_test "show substitute-path from" \
104         "Source path substitution rule matching `from':" \
105         "show substitute-path from, after unsetting it"
106
107gdb_test "show substitute-path" \
108         "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`depuis' -> `vers'.\r\n +`empty' -> `'." \
109         "show substitute-path after from rule removed"
110
111gdb_test "unset substitute-path from" \
112         "No substitution rule defined for `from'" \
113         "unset substitute-path from after the rule was removed"
114
115gdb_test_no_output "unset substitute-path depuis" \
116         "unset substitute-path depuis (middle of list)"
117
118gdb_test "show substitute-path" \
119         "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`empty' -> `'." \
120         "show substitute-path after depuis rule removed"
121
122gdb_test_no_output "unset substitute-path empty" \
123         "unset substitute-path empty (end of list)"
124
125gdb_test "show substitute-path" \
126         "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'." \
127         "show substitute-path after empty rule removed"
128
129gdb_test_no_output "unset substitute-path" \
130         "remove all remaining substitution rules"
131
132gdb_test "show substitute-path" \
133         "List of all source path substitution rules:" \
134         "show substitute-path after all remaining rules removed"
135
136
137