From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/6] gdb.base/interrupt.exp: Fix race
Date: Mon, 23 Feb 2015 13:54:00 -0000 [thread overview]
Message-ID: <1424699660-11727-2-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <1424699660-11727-1-git-send-email-palves@redhat.com>
Working on splitting gdb and inferior output handling in this test, I
noticed a race that happens to be masked out today.
The test sends "a\n" to the inferior, and then inferior echoes back
"a\n".
If expect manages to read only the first "a\r\n" into its buffer, then
this matches:
-re "^a\r\n(|a\r\n)$" {
and leaves the second "a\r\n" in output.
Then the next test that processes inferior I/O sends "data\n", and expects:
-re "^(\r\n|)data\r\n(|data\r\n)$"
which fails given the anchor and given "a\r\n" is still in the buffer.
This is masked today because the test relies on inferior I/O being
done on GDB's terminal, and there are tested GDB commands in between,
which consume the "a\r\n" that was left in the output.
We don't support SunOS4 anymore, so just remove the workaround.
gdb/testsuite/ChangeLog
2015-02-23 Pedro Alves <palves@redhat.com>
* gdb.base/interrupt.exp: Don't handle the case of the inferior
output appearing once only.
---
gdb/testsuite/gdb.base/interrupt.exp | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/gdb/testsuite/gdb.base/interrupt.exp b/gdb/testsuite/gdb.base/interrupt.exp
index 4c0fc77..82137e6 100644
--- a/gdb/testsuite/gdb.base/interrupt.exp
+++ b/gdb/testsuite/gdb.base/interrupt.exp
@@ -58,12 +58,10 @@ if ![file exists $binfile] then {
eof { fail "run (eof)" }
}
# This should appear twice, once for the echo and once for the
- # program's output. Under dejagnu (but not interactively) for
- # SunOS4, it only appears once. Don't worry about it, I imagine
- # dejagnu has just done something to the tty modes.
+ # program's output.
send_gdb "a\n"
gdb_expect {
- -re "^a\r\n(|a\r\n)$" {
+ -re "^a\r\na\r\n$" {
pass "child process ate our char"
}
timeout { fail "echo a (timeout)" }
@@ -155,7 +153,7 @@ if ![file exists $binfile] then {
# but the success is spurious. Need to provide the right reg.expr.
# here.
gdb_expect {
- -re "^(\r\n|)data\r\n(|data\r\n)$" { pass "echo data" }
+ -re "^(\r\n|)data\r\ndata\r\n$" { pass "echo data" }
-re "Undefined command.*$gdb_prompt " { fail "echo data" }
timeout { fail "echo data (timeout)" }
eof { fail "echo data (eof)" }
@@ -184,7 +182,7 @@ if ![file exists $binfile] then {
# We should be back in the loop.
send_gdb "more data\n"
gdb_expect {
- -re "^(\r\n|)more data\r\n(|more data\r\n)$" { pass "echo more data" }
+ -re "^(\r\n|)more data\r\nmore data\r\n$" { pass "echo more data" }
timeout { fail "echo more data (timeout)" }
eof { fail "echo more data (eof)" }
}
--
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 6/6] gdb.base/interrupt.exp: Use send_inferior/$inferior_spawn_id Pedro Alves
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 ` [PATCH 3/6] gdb_test_multiple: Fix user code argument processing 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 ` 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-2-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