Re: [PATCH] sparse: Make -Werror turn warnigns into errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 25, 2014 at 7:16 AM, Christopher Li <sparse@xxxxxxxxxxx> wrote:
> On Wed, Sep 24, 2014 at 11:42 PM, Thomas Graf <tgraf@xxxxxxx> 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
--- 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux