This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] gdb.mi/mi-nonstop-exit.exp: fix racy test (PR testsuite/12649)
- From: Marek Polacek <mpolacek at redhat dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 17 May 2011 20:37:58 +0200
- Subject: [PATCH] gdb.mi/mi-nonstop-exit.exp: fix racy test (PR testsuite/12649)
I've changed the gdb_test_multiple to ugly send_gdb+gdb_expect, since
we must not use the gdb_test_multiple (see PR 12647). Here, I think,
it is not possible to use the mi_gdb_test, because mi_gdb_test either PASSes,
or FAILs, but in the `-gdb-show non-stop' test, we have to use the
`$expect_out' and possibly set the `supported' variable iff in the gdb output
is "supported=*".
Otherwise, if the output is just the "^done,value="off"", it is still OK, we
just don't use `$expect_out'. Otherwise, this test FAILs. That said, this
test never PASSes, it can only fail.
Using the send_gdb+gdb_expect in place of the gdb_test_multiple cures a race,
the problem is with the trailing ^M, as shown in PR 12647.
Thus, I propose this patch. Tested with both read{,1}. OK?
2011-05-17 Marek Polacek <mpolacek@redhat.com>
* gdb.mi/i-nonstop-exit.exp: Use the send_gdb+gdb_expect instead of
the gdb_test_multiple.
--- gdb/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp.mp 2011-01-01 16:33:47.000000000 +0100
+++ gdb/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp 2011-05-17 20:32:52.708217970 +0200
@@ -37,13 +37,17 @@ mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load $binfile
set supported 0
-gdb_test_multiple "-gdb-show non-stop" "" {
- -re ".*\\^done,value=\"off\",supported=\"(\[^\"\]+)\"\r\n$mi_gdb_prompt$" {
+send_gdb "-gdb-show non-stop\n"
+gdb_expect {
+ -re "\\^done,value=\"off\",supported=\"(\[^\"\]+)\"\r\n$mi_gdb_prompt$" {
if { $expect_out(1,string) == "1" } {
set supported 1
}
}
+ -re "\\^done,value=\"off\"\r\n$mi_gdb_prompt$" {
+ }
-re ".*$mi_gdb_prompt$" {
+ fail "-gdb-show non-stop"
}
}