From patchwork Thu Oct 11 14:20:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 982470 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-487329-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="MovQPkJp"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 42WBjL6fxSz9sC2 for ; Fri, 12 Oct 2018 00:32:37 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=PEJBqDh9p+U5 tbzrIFh+VUZzrmtNJBW2rMrsmkswBR0DR5NLkg580+n6GpgDmVUOlcs7mYpu6kWV /+3qOjXWO94rurnyf8JR48w7unX3owj9FpKYOpSIc3Osn5eVNglD3H8JEuC0goMe 90DKCNAxaoCLf3ykGExQwLn2yjezYLQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=h7lznnHnbf4uHKQlx4 pukG9nE9k=; b=MovQPkJphXjaPNyWAH7XaxsY9+4SaaAiFdJt2xSYPJgDlfy1sU o8+4EjdLy0SeLtbyItzbjNjjYWbIauYbff/EzlGI79H0xPdL9GPnYviENzcvgaMp mTZeDQEilr3KWPtC0bXROb68HBKDLDm70ovmp90t+8V339K1DG/glyZxo= Received: (qmail 67032 invoked by alias); 11 Oct 2018 13:32:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 66913 invoked by uid 89); 11 Oct 2018 13:32:23 -0000 Authentication-Results: sourceware.org; auth=none 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, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=lastline 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, 11 Oct 2018 13:32:21 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A47A8307B972 for ; Thu, 11 Oct 2018 13:32:20 +0000 (UTC) Received: from c64.redhat.com (ovpn-112-34.phx2.redhat.com [10.3.112.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id C35FB62477; Thu, 11 Oct 2018 13:32:19 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH] multiline.exp: complain about mismatched dg-{begin|end}-multiline-output Date: Thu, 11 Oct 2018 10:20:26 -0400 Message-Id: <1539267626-57753-1-git-send-email-dmalcolm@redhat.com> X-IsSubscribed: yes Mismatched dg-{begin|end}-multiline-output directives are currently silently ignored, leading to difficult-to-diagnose test failures involving excess output. This patch makes multiline.exp complain about them. Successfully regrtested on x86_64-pc-linux-gnu OK for trunk? gcc/testsuite/ChangeLog: * lib/multiline.exp (dg-begin-multiline-output): Issue an error if there hasn't been a dg-end-multiline-output since the last dg-begin-multiline-output. (dg-end-multiline-output): Issue an error if there hasn't been a dg-begin-multiline-output. Reset _multiline_last_beginning_line as soon possible. Rename "line" to "last_line". --- gcc/testsuite/lib/multiline.exp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/gcc/testsuite/lib/multiline.exp b/gcc/testsuite/lib/multiline.exp index 6c7ecdf..6e431d9 100644 --- a/gcc/testsuite/lib/multiline.exp +++ b/gcc/testsuite/lib/multiline.exp @@ -72,6 +72,14 @@ proc dg-begin-multiline-output { args } { global _multiline_last_beginning_line verbose "dg-begin-multiline-output: args: $args" 3 set line [expr [lindex $args 0] + 1] + + # Complain if there hasn't been a dg-end-multiline-output + # since the last dg-begin-multiline-output + if { $_multiline_last_beginning_line != -1 } { + set last_directive_line [expr $_multiline_last_beginning_line - 1] + error "$last_directive_line: unterminated dg-begin-multiline-output" + } + set _multiline_last_beginning_line $line } @@ -84,8 +92,17 @@ proc dg-begin-multiline-output { args } { proc dg-end-multiline-output { args } { global _multiline_last_beginning_line verbose "dg-end-multiline-output: args: $args" 3 - set line [expr [lindex $args 0] - 1] - verbose "multiline output lines: $_multiline_last_beginning_line-$line" 3 + set first_line $_multiline_last_beginning_line + + # Complain if there hasn't been a dg-begin-multiline-output + if { $first_line == -1 } { + error "[lindex $args 0]: dg-end-multiline-output without dg-begin-multiline-output" + return + } + set _multiline_last_beginning_line -1 + + set last_line [expr [lindex $args 0] - 1] + verbose "multiline output lines: $first_line-$last_line" 3 if { [llength $args] > 3 } { error "[lindex $args 0]: too many arguments" @@ -109,16 +126,14 @@ proc dg-end-multiline-output { args } { # "prog" now contains the filename # Load it and split it into lines - set lines [_get_lines $prog $_multiline_last_beginning_line $line] + set lines [_get_lines $prog $first_line $last_line] verbose "lines: $lines" 3 # Create an entry of the form: first-line, last-line, lines, maybe_x - set entry [list $_multiline_last_beginning_line $line $lines $maybe_x] + set entry [list $first_line $last_line $lines $maybe_x] global multiline_expected_outputs lappend multiline_expected_outputs $entry verbose "within dg-end-multiline-output: multiline_expected_outputs: $multiline_expected_outputs" 3 - - set _multiline_last_beginning_line -1 } # Hook to be called by prune.exp's prune_gcc_output to