From patchwork Thu Oct 26 17:42:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 23863 Received: (qmail 2168 invoked by alias); 26 Oct 2017 17:42:34 -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 2069 invoked by uid 89); 26 Oct 2017 17:42:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= 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; Thu, 26 Oct 2017 17:42:33 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DBB283F747 for ; Thu, 26 Oct 2017 17:42:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DBB283F747 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Received: from cascais.lan (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BFC4600CA for ; Thu, 26 Oct 2017 17:42:31 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 3/6] Fix racy output matching in gdb.base/memattr.exp Date: Thu, 26 Oct 2017 18:42:24 +0100 Message-Id: <1509039747-15026-4-git-send-email-palves@redhat.com> In-Reply-To: <1509039747-15026-1-git-send-email-palves@redhat.com> References: <1509039747-15026-1-git-send-email-palves@redhat.com> Testing with: $ make check-read1 TESTS="gdb.base/memattr.exp" Exposes a testcase bug that can result in racy fails: info mem Using user-defined memory regions. Num Enb Low Addr High Addr Attrs 1 y 0x0000000000601060 0x0000000000601160 wo nocache 2 y 0x0000000000601180 0x0000000000601280 ro nocache 4 y 0x0000000000601280 0x0000000000601380 rw nocache 3 y 0x0000000000601380 0x0000000000601480 rw nocache 5 y 0x0000000000601480 0x0000000000601580 rw nocache (gdb) FAIL: gdb.base/memattr.exp: info mem (1) The problem is that: "Attrs\[^\n\r]*.." matches: "Attrs \r" when the output buffer is filled with partial output like this: "info mem\r\nUsing user-defined memory regions.\r\nNum Enb Low Addr High Addr Attrs \r" gdb/testsuite/ChangeLog: yyyy-mm-dd Pedro Alves * gdb.base/memattr.exp: Tighten regexes to match the end line. --- gdb/testsuite/gdb.base/memattr.exp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/gdb.base/memattr.exp b/gdb/testsuite/gdb.base/memattr.exp index 48f0496..88eb51c 100644 --- a/gdb/testsuite/gdb.base/memattr.exp +++ b/gdb/testsuite/gdb.base/memattr.exp @@ -114,30 +114,30 @@ set see4 0 set see5 0 set info_mem_header_pattern \ - "info mem.*Num\[ \t\]+Enb\[ \t\]+Low\[ \t\]+Addr\[ \t\]+High\[ \t\]+Addr\[ \t\]+Attrs\[^\n\r]*.." + "info mem.*Num\[ \t\]+Enb\[ \t\]+Low\[ \t\]+Addr\[ \t\]+High\[ \t\]+Addr\[ \t\]+Attrs\[^\r\n\]*\r\n" gdb_test_multiple "info mem" "info mem(1)" { -re ${info_mem_header_pattern} { # Discard the header. exp_continue } - -re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." { + -re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*\r\n" { set see1 1 exp_continue } - -re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." { + -re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*\r\n" { set see2 1 exp_continue } - -re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { + -re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*\r\n" { set see3 1 exp_continue } - -re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { + -re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*\r\n" { set see4 1 exp_continue } - -re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { + -re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*\r\n" { set see5 1 exp_continue }