From patchwork Wed Mar 19 15:57:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 165 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (caibbdcaaahb.dreamhost.com [208.113.200.71]) by wilcox.dreamhost.com (Postfix) with ESMTP id 9E1B13600D6 for ; Wed, 19 Mar 2014 08:58:48 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14314964) id 6188ECA324A; Wed, 19 Mar 2014 08:58:48 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx21.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id 3A337CA61B3 for ; Wed, 19 Mar 2014 08:58:48 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=E3zR7qsuAz9v28ePO6QcdKgLaRMs25B 9VtPcqDlC6ysajkxOfLVMLmJIuxjE8JvkzR6axKQcp5UcpwDnLqZnk7Q6SJ8pTup LggkmHbSU0mu+XOFbmdUpk3bjTLfoewCeJ15SryuQiP9DVyCOynNTDtlN3MIosJc uGFj6mexW+xM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=tPFc+C8qMhEQYZiZtIi5q+fx17I=; b=ND/de zyCGtBJr1h28UcGnFpCFIg4P0IQJ2TJye+qorRRpJ7omDSH3LbCS8pFcx9h75Uid JlVgW0g7NWsDLrpAofHelkyIDbuZiepg5ekrevVOpq+R841wWmdB3IAR3Q5071G2 pw+0K6Mysyj9jStoSqhC379vxKssyy/ZtkXlNE= Received: (qmail 20399 invoked by alias); 19 Mar 2014 15:58:13 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 20344 invoked by uid 89); 19 Mar 2014 15:58:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Mar 2014 15:58:11 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2JFw9uK008934 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 19 Mar 2014 11:58:10 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s2JFw1MH008699 for ; Wed, 19 Mar 2014 11:58:08 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PUSHED 6/8] gdb.base/async.exp: Fix races. Date: Wed, 19 Mar 2014 15:57:59 +0000 Message-Id: <1395244681-24272-7-git-send-email-palves@redhat.com> In-Reply-To: <1395244681-24272-1-git-send-email-palves@redhat.com> References: <1395244681-24272-1-git-send-email-palves@redhat.com> X-DH-Original-To: gdb@patchwork.siddhesh.in 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 * 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 + * gdb.base/async.exp (test_background): Expect \r\n after + "completed." in the fail pattern. + +2014-03-19 Pedro Alves + * 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 {