]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/async.exp
gdb.base/async.exp: Use prepare_for_testing.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / async.exp
CommitLineData
ecd75fc8 1# Copyright 1999-2014 Free Software Foundation, Inc.
104c1213
JM
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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
104c1213 6# (at your option) any later version.
e22f8b7c 7#
104c1213
JM
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.
e22f8b7c 12#
104c1213 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
104c1213 15
104c1213 16
104c1213
JM
17#
18# test running programs
19#
104c1213 20
a64d2530 21standard_testfile
104c1213 22
104c1213
JM
23########################################
24##
25## Don't do any of these tests until we reach consensus on this file.
26##
27return 0
28########################################
29
148e57e2
PA
30if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
31 untested $testfile.exp
32 return -1
33}
104c1213 34
0172b6a7
DE
35gdb_test_no_output "set target-async on"
36
104c1213
JM
37#
38# set it up at a breakpoint so we can play with it
39#
40if ![runto_main] then {
41 perror "couldn't run to breakpoint"
42 continue
43}
44
de7ff789 45gdb_test "break baz" ".*" ""
104c1213
JM
46
47#
48# Make sure we get a 'completed' message when the target is done.
49#
0172b6a7 50gdb_test_no_output "set exec-done-display on"
104c1213
JM
51
52
53send_gdb "next&\n"
54gdb_expect {
55 -re "^next&\r\n$gdb_prompt.*z = 9.*completed\.\r\n" { pass "next &" }
56 -re "$gdb_prompt.*completed\.$" { fail "next &" }
57 timeout { fail "(timeout) next &" }
58}
59
60send_gdb "step&\n"
61gdb_expect {
62 -re "^step&\r\n$gdb_prompt.*y = foo \\(\\).*completed\.\r\n" { pass "step &" }
63 -re "$gdb_prompt.*completed\.$" { fail "step &" }
64 timeout { fail "(timeout) step &" }
65}
66
67send_gdb "step&\n"
68gdb_expect {
69 -re "^step&\r\n$gdb_prompt foo \\(\\) at .*async.c.*x = 5.*completed\.\r\n" \
70 { pass "step &" }
71 -re "$gdb_prompt.*completed\.$" { fail "step &" }
72 timeout { fail "(timeout) step &" }
73}
74
75send_gdb "stepi&\n"
76gdb_expect {
77 -re "^stepi&\r\n$gdb_prompt.*$hex.*x = 5.*completed\.\r\n" { pass "stepi &" }
78 -re "$gdb_prompt.*completed\.$" { fail "stepi &" }
79 timeout { fail "(timeout) stepi &" }
80}
81
82send_gdb "nexti&\n"
83gdb_expect {
84 -re "^nexti&\r\n$gdb_prompt.*y = 3.*completed\.\r\n" { pass "nexti &" }
85 -re "$gdb_prompt.*completed\.$" { fail "nexti &" }
86 timeout { fail "(timeout) nexti &" }
87}
88
89send_gdb "finish&\n"
90gdb_expect {
91 -re "^finish&\r\nRun till exit from #0 foo \\(\\) at.*async.c.*\r\n$gdb_prompt.*$hex in main \\(\\) at.*async.c.*y = foo \\(\\).*Value returned is.*= 8.*completed\.\r\n" \
92 { pass "finish &" }
93 -re "$gdb_prompt.*completed\.$" { fail "finish &" }
94 timeout { fail "(timeout) finish &" }
95}
96
e2f6c966
PA
97set jump_here [gdb_get_line_number "jump here"]
98
99send_gdb "jump $jump_here&\n"
104c1213 100gdb_expect {
e2f6c966 101 -re "^jump $jump_here&.*Continuing at $hex.*$gdb_prompt.*Breakpoint 2, baz \\(\\) at.*async.c.*return 5.*completed\.\r\n" \
104c1213
JM
102 { pass "jump &" }
103 -re ".*$gdb_prompt.*completed\.$" { fail "jump &" }
104 timeout { fail "(timeout) jump &" }
105}
106
e2f6c966
PA
107set until_here [gdb_get_line_number "until here"]
108
109send_gdb "until $until_here&\n"
104c1213 110gdb_expect {
e2f6c966 111 -re "^until $until_here&.*$gdb_prompt.*$hex in main \\(\\) at.*async.c.*y = baz \\(\\).*completed\.\r\n" \
104c1213
JM
112 { pass "until &" }
113 -re "$gdb_prompt.*completed\.$" { fail "until &" }
114 timeout { fail "(timeout) until &" }
115}
116
0172b6a7 117gdb_test_no_output "set exec-done-display off"