From 0a1ca02b3b507cdcdc351c050f688cb983d75aa9 Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Wed, 2 Oct 2013 12:12:29 +0200 Subject: [PATCH] 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. --- qa/coccinelle/run_check.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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 -- 2.47.2