This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PUSHED 6/8] gdb.base/async.exp: Fix races.
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 19 Mar 2014 15:57:59 +0000
- Subject: [PUSHED 6/8] gdb.base/async.exp: Fix races.
- Authentication-results: sourceware.org; auth=none
- References: <1395244681-24272-1-git-send-email-palves at redhat dot com>
This test is currently racy:
PASS: gdb.base/async.exp: step&
stepi&
(gdb) 0x0000000000400547 14 x = 5; x = 5;
completed.
PASS: gdb.base/async.exp: stepi&
nexti&
(gdb) 15 y = 3;
completed.FAIL: gdb.base/async.exp: nexti&
The problem is here:
-re "^$command\r\n${before_prompt}${gdb_prompt}${after_prompt}completed\.\r\n" {
pass "$command"
}
-re "$gdb_prompt.*completed\.$" {
fail "$command"
}
Note how the fail pattern is a subset of the pass pattern. If the
expect buffer happens to end up with:
"^$command\r\n${before_prompt}${gdb_prompt}${after_prompt}completed\."
that is, the final "\r\n" has't reached the expect buffer yet, but
"completed." has, then the fail pattern matches...
gdb/testsuite/
2014-03-19 Pedro Alves <palves@redhat.com>
* gdb.base/async.exp (test_background): Expect \r\n after
"completed." in the fail pattern.
---
gdb/testsuite/ChangeLog | 5 +++++
gdb/testsuite/gdb.base/async.exp | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 509472d..a7237d2 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2014-03-19 Pedro Alves <palves@redhat.com>
+ * gdb.base/async.exp (test_background): Expect \r\n after
+ "completed." in the fail pattern.
+
+2014-03-19 Pedro Alves <palves@redhat.com>
+
* gdb.base/async.exp (test_background): New procedure.
Use it for all background execution command tests.
diff --git a/gdb/testsuite/gdb.base/async.exp b/gdb/testsuite/gdb.base/async.exp
index 65bec4d..a1c821c 100644
--- a/gdb/testsuite/gdb.base/async.exp
+++ b/gdb/testsuite/gdb.base/async.exp
@@ -67,7 +67,7 @@ proc test_background {command before_prompt after_prompt {message ""}} {
-re "^$command\r\n${before_prompt}${gdb_prompt}${after_prompt}completed\.\r\n" {
pass "$message"
}
- -re "$gdb_prompt.*completed\.$" {
+ -re "$gdb_prompt.*completed\.\r\n" {
fail "$message"
}
timeout {
--
1.7.11.7