aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/test-suite
diff options
authorThomas Graf <tgraf@suug.ch>2014-09-25 10:11:17 +0200
committerChristopher Li <sparse@chrisli.org>2014-09-28 08:58:55 +0800
commit4d8811879a1cc48c1cdd0b0466dc6865c715d149 (patch)
tree641f812c23f7cc7838d898c5c02db449679b63af /validation/test-suite
parenta5bdeee9e145cc4313526f9722f80674321ab491 (diff)
downloadsparse-dev-4d8811879a1cc48c1cdd0b0466dc6865c715d149.tar.gz
sparse: Make -Werror turn warnigns into errors
Make sparse fail and return an error code if a warning is encountered and -Werror is specified or a hard error is found. This allows to use sparse in automated build systems to more easily catch new sparse warnings. The validation script is extended to parse the expected output message for an error message and validate the a non zero return value if such a error message is found. Also changes cgcc to die if the checker fails. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'validation/test-suite')
-rwxr-xr-xvalidation/test-suite18
1 files changed, 12 insertions, 6 deletions
diff --git a/validation/test-suite b/validation/test-suite
index 3c011c6a..61667a56 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 \
- | grep -v check-error > "$file".error.expected
# grab the actual output & exit value
$cmd 1> $file.output.got 2> $file.error.got