Make dprintf-non-stop.exp cope with remote testing
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / dprintf-non-stop.exp
1 # Copyright (C) 2013-2015 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 if [is_remote target] then {
17 # Testing with remote/non-stop is racy at the moment.
18 unsupported "Testing dprintf with remote/non-stop is not supported."
19 return 0
20 }
21
22 standard_testfile
23 set executable ${testfile}
24
25 if [build_executable "failed to prepare for dprintf with non-stop" \
26 ${testfile} ${srcfile} {debug}] {
27 return -1
28 }
29
30 save_vars { GDBFLAGS } {
31 append GDBFLAGS " -ex \"set non-stop on\""
32 clean_restart ${executable}
33 }
34
35 if ![runto main] {
36 fail "Can't run to main"
37 return -1
38 }
39
40 gdb_test "dprintf foo,\"At foo entry\\n\"" "Dprintf .*"
41
42 gdb_test "continue &" "Continuing\\."
43
44 # Wait for the dprintf to trigger.
45 set test "dprintf triggered"
46 gdb_expect {
47 -re "At foo entry" {
48 pass "$test"
49 }
50 timeout {
51 fail "$test (timeout)"
52 }
53 }
54
55 # Now test that we're still able to issue commands. GDB used to
56 # implement re-resuming from dprintfs with a synchronous "continue" in
57 # the dprintf's command list, which stole the prompt from the user.
58 set test "interrupt"
59 gdb_test_multiple $test $test {
60 -re "interrupt\r\n$gdb_prompt " {
61 pass $test
62 }
63 }
64
65 set test "inferior stopped"
66 gdb_test_multiple "" $test {
67 -re "\r\n\\\[.*\\\] #1 stopped\\\.\r\n" {
68 pass $test
69 }
70 }
This page took 0.047688 seconds and 5 git commands to generate.