]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
coccinelle: implement parallel check 574/head
authorEric Leblond <eric@regit.org>
Wed, 2 Oct 2013 10:12:29 +0000 (12:12 +0200)
committerEric Leblond <eric@regit.org>
Wed, 2 Oct 2013 12:37:46 +0000 (14:37 +0200)
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.

qa/coccinelle/run_check.sh

index d233b6bf9f7cb7b3ec6fcc855a7235a4970baf94..da6d410e7c5c2f61261433eecfcc89d5ce7ef980 100755 (executable)
@@ -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