From patchwork Thu Sep 25 02:46:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Li X-Patchwork-Id: 4972031 Return-Path: X-Original-To: patchwork-linux-sparse@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 558F5BEEA6 for ; Thu, 25 Sep 2014 02:46:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 574262021A for ; Thu, 25 Sep 2014 02:46:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A8C5201C8 for ; Thu, 25 Sep 2014 02:46:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751272AbaIYCqX (ORCPT ); Wed, 24 Sep 2014 22:46:23 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:46138 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751259AbaIYCqW (ORCPT ); Wed, 24 Sep 2014 22:46:22 -0400 Received: by mail-wi0-f172.google.com with SMTP id em10so8036415wid.17 for ; Wed, 24 Sep 2014 19:46:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=xCK8m2DDjkbS7GOfuWGLWEyQJr+iSJ5NGIkshA/Ged4=; b=ruU9bMuM3CWrMeojOX1JcXwyU1o5CXd6CwC2M2d6Jv6YWxVurS0aIe/dj6R8iDxqdN VytxbKkKpm94keubIuyO5PS4LG+d6S3gVOAYa6FK+IT1ndzq6vaR+7eXBgoH4fRRGIRS AIRTmGNk7Y2LAUKq7Azv4fxqPLiLBL+tKayNIy/+FaH8xTpcpu6CeRMvjX5HvjCsCqWm 2nFV0xpWgv24XfTAbiczc4C1YAsPPKKJZP3K48Onxu1Xy5Sv0Cu0Hc8t9AiakPKxktks 3TnZjmrz9HiJsGKSsnJ1cgW8yqnwg5E7XTOB1naotW4ADTM5m3z5P4txeZNFwr6SRhwV C5lA== MIME-Version: 1.0 X-Received: by 10.180.75.210 with SMTP id e18mr1624227wiw.6.1411613181110; Wed, 24 Sep 2014 19:46:21 -0700 (PDT) Received: by 10.27.175.129 with HTTP; Wed, 24 Sep 2014 19:46:21 -0700 (PDT) In-Reply-To: References: <20140924154207.GD4966@casper.infradead.org> Date: Thu, 25 Sep 2014 10:46:21 +0800 X-Google-Sender-Auth: L7eKjX8CAyK_61XYW_Gloh1A5No Message-ID: Subject: Re: [PATCH] sparse: Make -Werror turn warnigns into errors From: Christopher Li To: Thomas Graf Cc: Linux-Sparse Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Sep 25, 2014 at 7:16 AM, Christopher Li wrote: > On Wed, Sep 24, 2014 at 11:42 PM, Thomas Graf wrote: >> >> The return value of thest will only be non zero if an actual error >> has been detected. It will remain zero if only warnings have been >> found. So we would need to parse the text between "check-exit-start" >> and "check-error-end" for the string "error:" or something a like >> that. I found that to be fragile and the explicit declaration of an >> expected failure to be superior as it also verifies whether an >> expected warning is properly treated as a warning or not. >> > > It does not conflict with what I said. My point is setting the *default* > value of the test case. You can still set the expected return value > explicitly using ""check-exit-value". There is nothing imprecise about it. > > It is just need a regular expression. In python that will be: > r"(?m)^\S+?:\d+:\d+: error:". > The test case is written in Perl, it will need some conversion in regular > expression pattern. So the bash version will be look like this, I briefly test it seems pass all test cases. Any feed back? Chris diff --gidiff --git a/validation/test-suite b/validation/test-suite index 3c011c6..f9cb6fe 100755 --- a/validation/test-suite +++ b/validation/test-suite diff --git a/validation/test-suite b/validation/test-suite index 3c011c6..f9cb6fe 100755 More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/validation/test-suite +++ b/validation/test-suite @@ -106,20 +106,26 @@ do_test() fi verbose "Using command : $cmd" + # grab the expected output + sed -n '/check-output-start/,/check-output-end/p' $file \ + | grep -v check-output > "$file".output.expected + sed -n '/check-error-start/,/check-error-end/p' $file \ + | grep -v check-error > "$file".error.expected + # grab the expected exit value get_value "check-exit-value" $file if [ "$?" -eq "0" ]; then expected_exit_value=`echo $last_result | tr -d ' '` else - expected_exit_value=0 + grep -q -E "^[^:]+:[[:digit:]]+:[[:digit:]]+: error:" "$file".error.expected + if [ "$?" -eq "0" ]; then + expected_exit_value=1 + else + expected_exit_value=0 + fi fi verbose "Expecting exit value: $expected_exit_value" - # grab the expected output - sed -n '/check-output-start/,/check-output-end/p' $file \ - | grep -v check-output > "$file".output.expected - sed -n '/check-error-start/,/check-error-end/p' $file \ -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org