* lib/gdb.exp (gdb_test): Between $pattern and $prompt, expect
[binutils-gdb.git] / gdb / testsuite / gdb.base / term.exp
1 # Copyright (C) 1988, 1990, 1991, 1992 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 2 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, write to the Free Software
15 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
19
20 # This file was written by Rob Savoye. (rob@cygnus.com)
21
22 if $tracelevel then {
23 strace $tracelevel
24 }
25
26 # This only works for native, I think.
27 if ![isnative] then {
28 warning "Term test case can't run on a target system."
29 continue
30 }
31
32 #
33 # test running programs
34 #
35 set prms_id 0
36 set bug_id 0
37
38 set binfile "run"
39
40 if ![file exists $objdir/$subdir/$binfile] then {
41 perror "$objdir/$subdir/$binfile does not exist."
42 return 0
43 }
44
45 gdb_reinitialize_dir $srcdir/$subdir
46 gdb_load $objdir/$subdir/$binfile
47
48 # Test that GDB correctly identifies that it does not control a terminal.
49 send "info terminal\n"
50 expect {
51 -re "No saved terminal information..*$prompt $"\
52 { send "run 5\n"
53 expect {
54 -re "Starting program.*$binfile.*120.*Program exited normally..*$prompt $"\
55 { send "info terminal\n"
56 expect {
57 -re "No saved terminal information..*$prompt $"\
58 { pass "info terminal" }
59 -re ".*$prompt $" { fail "info terminal" }
60 timeout { fail "(timeout) info terminal" }
61 }
62 }
63 -re ".*$prompt $" { fail "info terminal" }
64 timeout { fail "(timeout) info terminal" }
65 }
66 }
67 -re ".*$prompt $" { fail "info terminal" }
68 timeout { fail "(timeout) info terminal" }
69 }
70
71
72 # In mid-execution
73 send "break main\n"
74 expect {
75 -re "Breakpoint.*at.* file .*, line.*$prompt $"\
76 { send "run 5\n"
77 expect {
78 -re "Starting program.*Breakpoint \[0-9\]+,.*main.*if .argc != 2.*$prompt $"\
79 { send "info terminal\n"
80 expect {
81 -re "Inferior's terminal status .currently saved by GDB.:.*$prompt $"\
82 { pass "info terminal at breakpoint" }
83 -re ".*$prompt $" { fail "info terminal at breakpoint" }
84 timeout { fail "(timeout) info terminal at breakpoint" }
85 }
86 }
87 -re ".*$prompt $" { fail "info terminal at breakpoint" }
88 timeout { fail "(timeout) info terminal at breakpoint" }
89 }
90 }
91 -re ".*$prompt $" { fail "info terminal at breakpoint" }
92 timeout { fail "(timeout) info terminal at breakpoint" }
93 }
94
95