From ae7b5890ef728af40bd233a5011b924c482603bf Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Thu, 25 Jul 2019 14:35:34 +0200 Subject: [PATCH] githooks: limit the number of threads for pre-push hook The script probably meant to execute make with $(nproc), but executed it with ${nproc} instead. "nproc" was not defined, evaluated to nothing, and -j without integer spawned unlimited number of processes, which was slow. While here, also use sysctl -a | grep -E -i 'hw.ncpu' to get the number of cores on BSD. That's what we already do in autobuild.sh. Fixes #881 Change-Id: I8b07a2c28c4834b5dfb1c1bfa66d2b696d85720f Reported-by: Jan Kryl Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463179 Reviewed-by: Jan Kryl Reviewed-by: Paul Luse Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki Reviewed-by: Ben Walker Tested-by: SPDK CI Jenkins --- .githooks/pre-push | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.githooks/pre-push b/.githooks/pre-push index cb9efb5bf..dbf6ad80c 100755 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -20,10 +20,10 @@ SYSTEM=`uname -s` exec 1>&2 if [ "$SYSTEM" = "FreeBSD" ]; then - MAKE="gmake MAKE=gmake -j ${nproc}" + MAKE="gmake MAKE=gmake -j $(sysctl -a | grep -E -i 'hw.ncpu' | awk '{print $2}')" COMP="clang" else - MAKE="make -j ${nproc}" + MAKE="make -j $(nproc)" COMP="gcc" fi