From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1840 invoked by alias); 26 Oct 2017 17:42:32 -0000 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 Received: (qmail 1807 invoked by uid 89); 26 Oct 2017 17:42:32 -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=Hx-languages-length:1719 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:31 +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 24C4C806C6 for ; Thu, 26 Oct 2017 17:42:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 24C4C806C6 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.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 AA872600CA for ; Thu, 26 Oct 2017 17:42:29 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 1/6] Fix racy output matching in gdb.asm/asm-source.exp Date: Thu, 26 Oct 2017 17:42:00 -0000 Message-Id: <1509039747-15026-2-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> X-SW-Source: 2017-10/txt/msg00830.txt.bz2 Testing with: $ make check-read1 TESTS="gdb.asm/asm-source.exp" Exposes a testcase bug that can result in racy fails: (gdb) PASS: gdb.asm/asm-source.exp: next over foo3 return Make selected stack frame return now? (y or n) y n #0 main () at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.asm/asmsrc1.s:53 53 gdbasm_exit0 (gdb) FAIL: gdb.asm/asm-source.exp: return from foo2 (got interactive prompt) n The problem is that the "return now\?.*" regex can match partial output like this: "Make selected stack frame return no" and then we send the 'y' too early, and then the next time around we hit gdb_test_multiple's internal "got interactive prompt" regex. Also, note we match "return no" instead of "return now" because the regex is missing one quote level. gdb/testsuite/ChangeLog: yyyy-mm-dd Pedro Alves * gdb.asm/asm-source.exp ("kill" test): Match the whole query output. Fix '?' match. --- gdb/testsuite/gdb.asm/asm-source.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index 138609a..47717a2 100644 --- a/gdb/testsuite/gdb.asm/asm-source.exp +++ b/gdb/testsuite/gdb.asm/asm-source.exp @@ -435,7 +435,7 @@ gdb_test "next" "$line_foo2_leave\[ \t\]+gdbasm_leave" "next over foo3" # Like "finish", "return" command also can return to the caller # line again or the statement after, depending on the architecture. gdb_test_multiple "return" "return from foo2" { - -re "Make (foo2|selected stack frame) return now\?.*" { + -re "Make (foo2|selected stack frame) return now\\? .y or n. " { send_gdb "y\n" exp_continue } -- 2.5.5