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.
pull/190/head
Eric Leblond 13 years ago
parent 6e5caf6838
commit 8199832d71

@ -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

Loading…
Cancel
Save