]>
Commit | Line | Data |
---|---|---|
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 | 21 | standard_testfile |
104c1213 | 22 | |
104c1213 JM |
23 | ######################################## |
24 | ## | |
25 | ## Don't do any of these tests until we reach consensus on this file. | |
26 | ## | |
27 | return 0 | |
28 | ######################################## | |
29 | ||
148e57e2 PA |
30 | if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} { |
31 | untested $testfile.exp | |
32 | return -1 | |
33 | } | |
104c1213 | 34 | |
0172b6a7 DE |
35 | gdb_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 | # | |
40 | if ![runto_main] then { | |
41 | perror "couldn't run to breakpoint" | |
42 | continue | |
43 | } | |
44 | ||
de7ff789 | 45 | gdb_test "break baz" ".*" "" |
104c1213 JM |
46 | |
47 | # | |
48 | # Make sure we get a 'completed' message when the target is done. | |
49 | # | |
0172b6a7 | 50 | gdb_test_no_output "set exec-done-display on" |
104c1213 | 51 | |
884e37dc PA |
52 | # Test a background execution command. COMMAND is the command to |
53 | # send. BEFORE_PROMPT is the pattern expected before the GDB prompt | |
54 | # is output. AFTER_PROMPT is the pattern expected after the prompt | |
55 | # and before "completed". MESSAGE is optional, and is the pass/fail | |
56 | # message to br printed. If omitted, then the command string is used | |
57 | # as message. | |
58 | proc test_background {command before_prompt after_prompt {message ""}} { | |
59 | global gdb_prompt | |
60 | ||
61 | if {$message eq ""} { | |
62 | set message $command | |
63 | } | |
64 | ||
65 | send_gdb "$command\n" | |
66 | gdb_expect { | |
67 | -re "^$command\r\n${before_prompt}${gdb_prompt}${after_prompt}completed\.\r\n" { | |
68 | pass "$message" | |
69 | } | |
8bcfb00a | 70 | -re "$gdb_prompt.*completed\.\r\n" { |
884e37dc PA |
71 | fail "$message" |
72 | } | |
73 | timeout { | |
74 | fail "$message (timeout)" | |
75 | } | |
76 | } | |
104c1213 JM |
77 | } |
78 | ||
884e37dc | 79 | test_background "next&" "" ".*z = 9.*" |
104c1213 | 80 | |
884e37dc | 81 | test_background "step&" "" ".*y = foo \\(\\).*" |
104c1213 | 82 | |
884e37dc | 83 | test_background "step&" "" " foo \\(\\) at .*async.c.*x = 5.*" |
104c1213 | 84 | |
884e37dc | 85 | test_background "stepi&" "" ".*$hex.*x = 5.*" |
104c1213 | 86 | |
884e37dc | 87 | test_background "nexti&" "" ".*y = 3.*" |
104c1213 | 88 | |
884e37dc PA |
89 | test_background "finish&" \ |
90 | "Run till exit from #0 foo \\(\\) at.*async.c.*\r\n" \ | |
91 | ".*$hex in main \\(\\) at.*async.c.*y = foo \\(\\).*Value returned is.*= 8.*" | |
e2f6c966 | 92 | |
884e37dc PA |
93 | set jump_here [gdb_get_line_number "jump here"] |
94 | test_background "jump $jump_here&" \ | |
95 | ".*Continuing at $hex.*" \ | |
96 | ".*Breakpoint 2, baz \\(\\) at.*async.c.*return 5.*" \ | |
97 | "jump&" | |
104c1213 | 98 | |
e2f6c966 | 99 | set until_here [gdb_get_line_number "until here"] |
884e37dc PA |
100 | test_background "until $until_here&" \ |
101 | ".*" \ | |
102 | ".*$hex in main \\(\\) at.*async.c.*y = baz \\(\\).*" \ | |
103 | "until&" | |
104c1213 | 104 | |
0172b6a7 | 105 | gdb_test_no_output "set exec-done-display off" |