aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/subst.exp
blob: 1bd0f0a043fdfce8a223b20c509eb26f7136131d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# Copyright 2006, 2007, 2008 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

if $tracelevel {
    strace $tracelevel
}

gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir

# Do a bunch of testing of the set/unset/show substitute-path
# commands that do not require the presence of an executable.

gdb_test "set confirm off" \
         "" \
         "deactivate GDB's confirmation interface"

gdb_test "show substitute-path" \
         "List of all source path substitution rules:" \
         "show substitute-path, no rule entered yet"

gdb_test "show substitute-path from" \
         "Source path substitution rule matching `from':" \
         "show substitute-path from, no rule entered yet"

gdb_test "show substitute-path too many" \
         "Too many arguments in command" \
         "show substitute-path, too many arguments"

gdb_test "unset substitute-path from" \
         "No substitution rule defined for `from'" \
         "unset substitute-path from, no rule entered yet"

gdb_test "unset substitute-path" \
         "" \
         "unset substitute-path, no rule entered yet"

gdb_test "unset substitute-path from" \
         "No substitution rule defined for `from'" \
         "unset substitute-path from, no rule entered yet"

gdb_test "unset substitute-path from to" \
         "Incorrect usage, too many arguments in command" \
         "unset substitute-path, too many arguments"

gdb_test "set substitute-path too many arguments" \
         "Incorrect usage, too many arguments in command" \
         "set substitute-path, too many arguments"

gdb_test "set substitute-path missing" \
         "Incorrect usage, too few arguments in command" \
         "set substitute-path, too few arguments"

gdb_test "set substitute-path '' to" \
         "First argument must be at least one character long" \
         "set substitute-path, first argument is empty string"

gdb_test "set substitute-path from to" \
         "" \
         "add from -> to substitution rule"

gdb_test "set substitute-path from1 to1/" \
         "" \
         "add from1 -> to1 substitution rule"

gdb_test "set substitute-path source destination" \
         "" \
         "add source -> destination substitution rule"

gdb_test "set substitute-path depuis/ vers" \
         "" \
         "add depuis -> vers substitution rule"

gdb_test "set substitute-path empty ''" \
         "" \
         "add substitution rule to empty string"

gdb_test "show substitute-path" \
         "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' -> `'." \
         "show substitute-path after all paths added"

gdb_test "show substitute-path from" \
         "Source path substitution rule matching `from':\r\n +`from' -> `to'." \
         "show substitute-path from, after all paths added"

gdb_test "show substitute-path depuis" \
         "Source path substitution rule matching `depuis':\r\n +`depuis' -> `vers'." \
         "show substitute-path depuis, after all paths added"

gdb_test "show substitute-path garbage" \
         "Source path substitution rule matching `garbage':" \
         "show substitute-path garbage, after all paths added"

gdb_test "unset substitute-path from" \
         "" \
         "unset substitute-path from"

gdb_test "show substitute-path from" \
         "Source path substitution rule matching `from':" \
         ""

gdb_test "show substitute-path" \
         "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`depuis' -> `vers'.\r\n +`empty' -> `'." \
         "show substitute-path after from rule removed"

gdb_test "unset substitute-path from" \
         "No substitution rule defined for `from'" \
         "unset substitute-path from after the rule was removed"

gdb_test "unset substitute-path depuis" \
         "" \
         "unset substitute-path depuis (middle of list)"

gdb_test "show substitute-path" \
         "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`empty' -> `'." \
         "show substitute-path after depuis rule removed"

gdb_test "unset substitute-path empty" \
         "" \
         "unset substitute-path empty (end of list)"

gdb_test "show substitute-path" \
         "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'." \
         "show substitute-path after empty rule removed"

gdb_test "unset substitute-path" \
         "" \
         "remove all remaining substitution rules"

gdb_test "show substitute-path" \
         "List of all source path substitution rules:" \
         "show substitute-path after all remaining rules removed"