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.
pull/574/head
Eric Leblond 12 years ago
parent c5cd3562d0
commit 0a1ca02b3b

@ -19,11 +19,22 @@ else
PREFIX=$(git rev-parse --show-toplevel)/ PREFIX=$(git rev-parse --show-toplevel)/
fi 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 for SMPL in $(git rev-parse --show-toplevel)/qa/coccinelle/*.cocci; do
echo "Testing cocci file: $SMPL" echo "Testing cocci file: $SMPL"
for FILE in $LIST ; do if command -v parallel >/dev/null; then
spatch --very-quiet -sp_file $SMPL --undefined UNITTESTS $PREFIX$FILE || exit 1; echo -n $LIST | parallel -d ' ' -j $CONCURRENCY_LEVEL spatch --very-quiet -sp_file $SMPL --undefined UNITTESTS $PREFIX{} || exit 1;
done else
for FILE in $LIST ; do
spatch --very-quiet -sp_file $SMPL --undefined UNITTESTS $PREFIX$FILE || exit 1;
done
fi
done done
exit 0 exit 0

Loading…
Cancel
Save