check_format: use -P$(nproc) to speed up this script

With this change on 48 core system the checking format takes ~4.5s which
is acceptable execution time.


Change-Id: Icc97466c59a7a1072fcbd705203fc8ee0dba158e
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/431355
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Pawel Wodkowski 2018-10-30 16:58:42 +01:00 committed by Jim Harris
parent 8cbbdf2ddf
commit 38103f1f59

View File

@ -6,6 +6,14 @@ cd $BASEDIR
# exit on errors
set -e
if ! hash nproc 2>/dev/null; then
function nproc() {
echo 8
}
fi
rc=0
echo -n "Checking file permissions..."
@ -65,7 +73,7 @@ if hash astyle; then
# coding standards.
git ls-files '*.[ch]' '*.cpp' '*.cc' '*.cxx' '*.hh' '*.hpp' | \
grep -v rte_vhost | grep -v cpp_headers | \
xargs astyle --options=.astylerc >> astyle.log
xargs -P$(nproc) -n10 astyle --options=.astylerc >> astyle.log
if grep -q "^Formatted" astyle.log; then
echo " errors detected"
git diff
@ -151,7 +159,7 @@ rm -f badcunit.log
echo -n "Checking blank lines at end of file..."
if ! git grep -I -l -e . -z | \
xargs -0 -P8 -n1 scripts/eofnl > eofnl.log; then
xargs -0 -P$(nproc) -n1 scripts/eofnl > eofnl.log; then
echo " Incorrect end-of-file formatting detected"
cat eofnl.log
rc=1
@ -183,7 +191,7 @@ if [ ! -z ${PEP8} ]; then
PEP8_ARGS+=" --max-line-length=140"
error=0
git ls-files '*.py' | xargs -n1 $PEP8 $PEP8_ARGS > pep8.log || error=1
git ls-files '*.py' | xargs -P$(nproc) -n1 $PEP8 $PEP8_ARGS > pep8.log || error=1
if [ $error -ne 0 ]; then
echo " Python formatting errors detected"
cat pep8.log