1# Copyright 2006-2016 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 16gdb_exit 17gdb_start 18gdb_reinitialize_dir $srcdir/$subdir 19 20# Do a bunch of testing of the set/unset/show substitute-path 21# commands that do not require the presence of an executable. 22 23gdb_test_no_output "set confirm off" \ 24 "deactivate GDB's confirmation interface" 25 26# Clear any substitution rules that are available by default due 27# to GDB being configured with --with-relocated-sources. 28 29gdb_test_no_output "unset substitute-path" \ 30 "remove default substitution rules" 31 32gdb_test "show substitute-path" \ 33 "List of all source path substitution rules:" \ 34 "show substitute-path, no rule entered yet" 35 36gdb_test "show substitute-path from" \ 37 "Source path substitution rule matching `from':" \ 38 "show substitute-path from, no rule entered yet" 39 40gdb_test "show substitute-path too many" \ 41 "Too many arguments in command" \ 42 "show substitute-path, too many arguments" 43 44gdb_test "unset substitute-path from" \ 45 "No substitution rule defined for `from'" \ 46 "unset substitute-path from, no rule entered yet" 47 48gdb_test_no_output "unset substitute-path" \ 49 "unset substitute-path, no rule entered yet" 50 51gdb_test "unset substitute-path from" \ 52 "No substitution rule defined for `from'" \ 53 "unset substitute-path from, no rule entered yet" 54 55gdb_test "unset substitute-path from to" \ 56 "Incorrect usage, too many arguments in command" \ 57 "unset substitute-path, too many arguments" 58 59gdb_test "set substitute-path too many arguments" \ 60 "Incorrect usage, too many arguments in command" \ 61 "set substitute-path, too many arguments" 62 63gdb_test "set substitute-path missing" \ 64 "Incorrect usage, too few arguments in command" \ 65 "set substitute-path, too few arguments" 66 67gdb_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 71gdb_test_no_output "set substitute-path from to" \ 72 "add from -> to substitution rule" 73 74gdb_test_no_output "set substitute-path from1 to1/" \ 75 "add from1 -> to1 substitution rule" 76 77gdb_test_no_output "set substitute-path source destination" \ 78 "add source -> destination substitution rule" 79 80gdb_test_no_output "set substitute-path depuis/ vers" \ 81 "add depuis -> vers substitution rule" 82 83gdb_test_no_output "set substitute-path empty ''" \ 84 "add substitution rule to empty string" 85 86gdb_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" 89 90gdb_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" 93 94gdb_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" 97 98gdb_test "show substitute-path from/path" \ 99 "Source path substitution rule matching `from/path':\r\n +`from' -> `to'." \ 100 "show substitute-path from/path, after all paths added" 101 102gdb_test "show substitute-path from_a_bad_path" \ 103 "Source path substitution rule matching `from_a_bad_path':" \ 104 "show substitute-path from_a_bad_path, after all paths added" 105 106gdb_test "show substitute-path garbage" \ 107 "Source path substitution rule matching `garbage':" \ 108 "show substitute-path garbage, after all paths added" 109 110gdb_test_no_output "unset substitute-path from" \ 111 "unset substitute-path from" 112 113gdb_test "show substitute-path from" \ 114 "Source path substitution rule matching `from':" \ 115 "show substitute-path from, after unsetting it" 116 117gdb_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" 120 121gdb_test "unset substitute-path from" \ 122 "No substitution rule defined for `from'" \ 123 "unset substitute-path from after the rule was removed" 124 125gdb_test_no_output "unset substitute-path depuis" \ 126 "unset substitute-path depuis (middle of list)" 127 128gdb_test "show substitute-path" \ 129 "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`empty' -> `'." \ 130 "show substitute-path after depuis rule removed" 131 132gdb_test_no_output "unset substitute-path empty" \ 133 "unset substitute-path empty (end of list)" 134 135gdb_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 139gdb_test_no_output "unset substitute-path" \ 140 "remove all remaining substitution rules" 141 142gdb_test "show substitute-path" \ 143 "List of all source path substitution rules:" \ 144 "show substitute-path after all remaining rules removed" 145 146 147