From: Eric Leblond Date: Fri, 9 Nov 2012 14:57:52 +0000 (+0100) Subject: coccinelle: improve run_check X-Git-Tag: suricata-1.4beta3~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8199832d71bb5e06e0e95814025a1e7dca4ac242;p=thirdparty%2Fsuricata.git coccinelle: improve run_check This patch adds two features to run_check.sh, it is now posssible to specify a list of files to check: ./run_check.sh ../../src/suricata.c ../../src/detect.c It is also possible to ask a review of the files modified by a commit. To so simply put the SHA1 as argument ./run_check.sh HEAD ./run_check 6af7d5f It is also possible to check all the files for an arbitrary range: ./run_check.sh origin/master..buildbot-fixes Last improvement of this patch is to get a real error message in case of problem as 2 is not redirected anymore to /dev/null. --- diff --git a/qa/coccinelle/run_check.sh b/qa/coccinelle/run_check.sh index dce88d52e5..a125cdbc85 100755 --- a/qa/coccinelle/run_check.sh +++ b/qa/coccinelle/run_check.sh @@ -1,7 +1,19 @@ #!/bin/sh if [ $1 ]; then - LIST=$1; + case $1 in + *[ch]) + LIST=$@; + ;; + *..*) + LIST=$(git diff --pretty="format:" --name-only $1 | grep -E '[ch]$') + PREFIX="../../" + ;; + *) + LIST=$(git show --pretty="format:" --name-only $1 | grep -E '[ch]$') + PREFIX="../../" + ;; + esac else LIST=$(git ls-tree -r --name-only --full-tree HEAD src/ | grep -E '*.c$') PREFIX="../../" @@ -10,7 +22,7 @@ fi for SMPL in *.cocci; do echo "Testing cocci file: $SMPL" for FILE in $LIST ; do - spatch -sp_file $SMPL --undefined UNITTESTS $PREFIX$FILE 2>/dev/null || exit 1; + spatch --very-quiet -sp_file $SMPL --undefined UNITTESTS $PREFIX$FILE || exit 1; done done