From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 6/6] gdb.base/interrupt.exp: Use send_inferior/$inferior_spawn_id
Date: Mon, 23 Feb 2015 13:54:00 -0000 [thread overview]
Message-ID: <1424699660-11727-7-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <1424699660-11727-1-git-send-email-palves@redhat.com>
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-02-23 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.
---
gdb/testsuite/gdb.base/interrupt.exp | 56 ++++++++++++++++++++++++------------
1 file changed, 37 insertions(+), 19 deletions(-)
diff --git a/gdb/testsuite/gdb.base/interrupt.exp b/gdb/testsuite/gdb.base/interrupt.exp
index 55c8fca..d093ff5 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
--
1.9.3
next prev parent reply other threads:[~2015-02-23 13:54 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-23 13:54 [PATCH 0/6] Introduce $inferior_spawn_id, make interrupt.exp work with GDBserver Pedro Alves
2015-02-23 13:54 ` [PATCH 3/6] gdb_test_multiple: Fix user code argument processing Pedro Alves
2015-02-23 13:54 ` [PATCH 1/6] gdb.base/interrupt.exp: Fix race Pedro Alves
2015-02-23 13:54 ` [PATCH 4/6] testsuite: Don't use expect_background to reap gdbserver Pedro Alves
2015-04-13 11:42 ` Yao Qi
2015-04-13 12:09 ` Pedro Alves
2015-04-13 13:25 ` Yao Qi
2015-04-13 13:52 ` Pedro Alves
2015-04-13 14:20 ` Yao Qi
2015-04-13 14:22 ` Pedro Alves
2015-04-13 14:48 ` Yao Qi
2015-02-23 13:54 ` [PATCH 2/6] gdb.base/interrupt.exp: Use gdb_test_multiple instead of gdb_expect Pedro Alves
2015-02-23 13:54 ` Pedro Alves [this message]
2015-02-23 14:28 ` [PATCH 5/6] testsuite: Introduce $inferior_spawn_id Pedro Alves
2015-02-24 16:31 ` Yao Qi
2015-02-27 10:42 ` Pedro Alves
2015-02-27 10:59 ` Pedro Alves
2015-02-27 11:01 ` Pedro Alves
2015-02-27 12:12 ` Yao Qi
2015-02-27 13:59 ` [pushed] Add "../lib/unbuffer_output.c" and use it in gdb.base/interrupt.c (Re: [PATCH 5/6] testsuite: Introduce $inferior_spawn_id) Pedro Alves
2015-02-27 14:13 ` Yao Qi
2015-02-27 14:42 ` Eli Zaretskii
2015-02-27 14:47 ` Pedro Alves
2015-02-27 12:08 ` [PATCH 5/6] testsuite: Introduce $inferior_spawn_id Yao Qi
2015-02-27 12:30 ` Pedro Alves
2015-04-16 16:55 ` Antoine Tremblay
2015-04-16 17:14 ` Pedro Alves
2015-04-21 18:25 ` Pedro Alves
2015-04-21 18:32 ` Antoine Tremblay
2015-04-07 17:31 ` [PATCH 0/6] Introduce $inferior_spawn_id, make interrupt.exp work with GDBserver Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1424699660-11727-7-git-send-email-palves@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox