From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14434 invoked by alias); 17 May 2011 18:38:16 -0000 Received: (qmail 14425 invoked by uid 22791); 17 May 2011 18:38:15 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 May 2011 18:38:02 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4HIc1Gi016328 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 17 May 2011 14:38:01 -0400 Received: from dhcp-25-89.brq.redhat.com (pdp-11.brq.redhat.com [10.34.24.63]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p4HIc0vg031291 for ; Tue, 17 May 2011 14:38:01 -0400 Message-ID: <4DD2C086.80108@redhat.com> Date: Tue, 17 May 2011 18:38:00 -0000 From: Marek Polacek User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100827 Red Hat Thunderbird/3.1.3 MIME-Version: 1.0 To: "gdb-patches@sourceware.org" Subject: [PATCH] gdb.mi/mi-nonstop-exit.exp: fix racy test (PR testsuite/12649) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-05/txt/msg00388.txt.bz2 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 * 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" } }