From: Eric Leblond Date: Wed, 2 Oct 2013 10:12:29 +0000 (+0200) Subject: coccinelle: implement parallel check X-Git-Tag: suricata-2.0beta2~262 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F574%2Fhead;p=thirdparty%2Fsuricata.git coccinelle: implement parallel check This patch is an implementation of parallel check of files. It uses GNU parallel to run multiple spatch at once. The concurrency level is set via the CONCURRENCY_LEVEL environment variable. --- diff --git a/qa/coccinelle/run_check.sh b/qa/coccinelle/run_check.sh index d233b6bf9f..da6d410e7c 100755 --- a/qa/coccinelle/run_check.sh +++ b/qa/coccinelle/run_check.sh @@ -19,11 +19,22 @@ else PREFIX=$(git rev-parse --show-toplevel)/ fi +if [ -z "$CONCURRENCY_LEVEL" ]; then + CONCURRENCY_LEVEL=1 + echo "No concurrency" +else + echo "Using concurrency level $CONCURRENCY_LEVEL" +fi + for SMPL in $(git rev-parse --show-toplevel)/qa/coccinelle/*.cocci; do echo "Testing cocci file: $SMPL" - for FILE in $LIST ; do - spatch --very-quiet -sp_file $SMPL --undefined UNITTESTS $PREFIX$FILE || exit 1; - done + if command -v parallel >/dev/null; then + echo -n $LIST | parallel -d ' ' -j $CONCURRENCY_LEVEL spatch --very-quiet -sp_file $SMPL --undefined UNITTESTS $PREFIX{} || exit 1; + else + for FILE in $LIST ; do + spatch --very-quiet -sp_file $SMPL --undefined UNITTESTS $PREFIX$FILE || exit 1; + done + fi done exit 0