summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2015-04-07 18:19:31 +0100
committerPedro Alves <palves@redhat.com>2015-04-07 18:29:12 +0100
commitb97fde9213b9217499959f7aebbf076b00c7008b (patch)
tree2c51766ac2a63a99e6781090f493cc913d5d090e
parentf71c18e755dac28c61a5e5c94fbc8a84eb573679 (diff)
downloadbinutils-gdb-b97fde9213b9217499959f7aebbf076b00c7008b.tar.gz
gdb.base/interrupt.exp: Use send_inferior/$inferior_spawn_id
The gdb.base/interrupt.exp test is important for testing system call restarting, but because it depends on inferior I/O, it ends up skipped against gdbserver. This patch adjusts the test to use send_inferior and $inferior_spawn_id so it works against GDBserver. gdb/testsuite/ChangeLog: 2015-04-07 Pedro Alves <palves@redhat.com> * gdb.base/interrupt.exp: Don't skip if $inferior_spawn_id != $gdb_spawn_id. Use send_inferior and $inferior_spawn_id to interact with inferior program.
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.base/interrupt.exp56
2 files changed, 43 insertions, 19 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d1728572508..6205b2d7641 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2015-04-07 Pedro Alves <palves@redhat.com>
+ * gdb.base/interrupt.exp: Don't skip if $inferior_spawn_id !=
+ $gdb_spawn_id. Use send_inferior and $inferior_spawn_id to
+ interact with inferior program.
+
+2015-04-07 Pedro Alves <palves@redhat.com>
+
* lib/gdb.exp (inferior_spawn_id): New global.
(gdb_test_multiple): Handle "-i". Reset the spawn id to GDB's
spawn id after processing the user code.
diff --git a/gdb/testsuite/gdb.base/interrupt.exp b/gdb/testsuite/gdb.base/interrupt.exp
index 55c8fca550a..d093ff54e2f 100644
--- a/gdb/testsuite/gdb.base/interrupt.exp
+++ b/gdb/testsuite/gdb.base/interrupt.exp
@@ -18,12 +18,6 @@ if [target_info exists gdb,nointerrupts] {
continue
}
-if [target_info exists gdb,noinferiorio] {
- verbose "Skipping interrupt.exp because of noinferiorio."
- return
-}
-
-
standard_testfile
set options { debug }
@@ -49,9 +43,16 @@ if ![file exists $binfile] then {
gdb_test "shell stty intr '^C'" ".*" \
"set interrupt character in interrupt.exp"
if [runto_main] then {
+ global inferior_spawn_id gdb_spawn_id
+
+ if {[target_info exists gdb,noinferiorio] && $inferior_spawn_id == $gdb_spawn_id} {
+ verbose "Skipping interrupt.exp because of noinferiorio."
+ return
+ }
+
set msg "process is alive"
gdb_test_multiple "continue" $msg {
- -re "\r\ntalk to me baby\r\n" {
+ -i "$inferior_spawn_id" -re "talk to me baby\r\n" {
pass $msg
}
}
@@ -60,9 +61,9 @@ if ![file exists $binfile] then {
# program's output.
set msg "child process ate our char"
- send_gdb "a\n"
+ send_inferior "a\n"
gdb_test_multiple "" $msg {
- -re "^a\r\na\r\n$" {
+ -i "$inferior_spawn_id" -re "^a\r\na\r\n$" {
pass $msg
}
}
@@ -120,8 +121,8 @@ if ![file exists $binfile] then {
setup_xfail "*-*-hpux*"
setup_xfail "*-*-*lynx*"
fail "$msg (stays asleep)"
- # Send_Gdb a newline to wake it up
- send_gdb "\n"
+ # Send the inferior a newline to wake it up.
+ send_inferior "\n"
gdb_test "" " = 4" "call function after waking it"
}
}
@@ -148,7 +149,7 @@ if ![file exists $binfile] then {
}
}
- send_gdb "data\n"
+ send_inferior "data\n"
# The optional leading \r\n is in case we sent a newline above
# to wake the program, in which case the program now sends it
# back.
@@ -158,10 +159,10 @@ if ![file exists $binfile] then {
set msg "echo data"
gdb_test_multiple "" $msg {
- -re "^(\r\n|)data\r\ndata\r\n$" {
+ -i "$inferior_spawn_id" -re "^(\r\n|)data\r\ndata\r\n$" {
pass $msg
}
- -re "Undefined command.*$gdb_prompt " {
+ -i "$gdb_spawn_id" -re "Undefined command.*$gdb_prompt " {
fail $msg
}
}
@@ -189,23 +190,40 @@ if ![file exists $binfile] then {
}
# We should be back in the loop.
- send_gdb "more data\n"
+ send_inferior "more data\n"
set msg "echo more data"
gdb_test_multiple "" $msg {
- -re "^(\r\n|)more data\r\nmore data\r\n$" {
+ -i "$inferior_spawn_id" -re "^(\r\n|)more data\r\nmore data\r\n$" {
pass $msg
}
}
}
+ set saw_eof 0
+ set saw_inferior_exit 0
+
set msg "send end of file"
- send_gdb "\004"
+ send_inferior "\004"
gdb_test_multiple "" $msg {
- -re "end of file.*$inferior_exited_re normally.*$gdb_prompt $" {
- pass $msg
+ -i "$inferior_spawn_id" -re "end of file" {
+ verbose -log "saw eof: $saw_eof"
+ set saw_eof 1
+ verbose -log "saw eof"
+ if {!$saw_inferior_exit} {
+ exp_continue
+ }
+ }
+ -i "$gdb_spawn_id" -re "$inferior_exited_re normally.*$gdb_prompt " {
+ set saw_inferior_exit 1
+ verbose -log "saw inferior exit"
+ if {!$saw_eof} {
+ exp_continue
+ }
}
}
+
+ gdb_assert { $saw_eof && $saw_inferior_exit } $msg
}
}
return 0