[gdb/testsuite] Factor out lib/valgrind.exp
[external/binutils.git] / gdb / testsuite / gdb.base / filesym.exp
1 # Copyright 2013-2018 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 # This series of completion tests checks the completion output
17 # on a name which is potentially both a symbol name and a file name.
18
19 standard_testfile
20
21 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
22     return -1
23 }
24
25 if { ![readline_is_used] } {
26     unsupported "completion doesn't work when readline isn't used."
27     return -1
28 }
29
30
31 # Test completion list for "filesy".  We expect the immediate result to
32 # complete to "filesym"; completing again, we expect the symbol name and the
33 # filename (in that order).
34
35 set tst "complete on \"filesy\""
36 send_gdb "break filesy\t"
37 gdb_test_multiple "" $tst {
38     -re "break filesy\\\x07m\$" {
39         pass $tst
40
41         # Now ask for the completion list
42         set tst "completion list for \"filesym\""
43         send_gdb "\t\t"
44         gdb_test_multiple "" $tst {
45             -re "\\\x07\r\nfilesym\[ \t\]+filesym.c\[ \t\]+\r\n$gdb_prompt " {
46                 pass $tst
47
48                 # Flush the rest of the output by creating the breakpoint.
49                 # This ensures this file passes testsuite/12649.
50                 send_gdb "\n"
51                 gdb_test "" "Breakpoint 1.*" "set breakpoint at filesym"
52             }
53         }
54     }
55 }
56
57 unset -nocomplain tst