Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Marek Polacek <mpolacek@redhat.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [PATCH] gdb.mi/mi-nonstop-exit.exp: fix racy test (PR testsuite/12649)
Date: Tue, 17 May 2011 18:38:00 -0000	[thread overview]
Message-ID: <4DD2C086.80108@redhat.com> (raw)

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"
     }   
 }


             reply	other threads:[~2011-05-17 18:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-17 18:38 Marek Polacek [this message]
2011-05-19  9:06 ` Marek Polacek

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=4DD2C086.80108@redhat.com \
    --to=mpolacek@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