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 <jan.kryl@mayadata.io>
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463179
Reviewed-by: Jan Kryl <jan.kryl@mayadata.io>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Darek Stojaczyk 2019-07-25 14:35:34 +02:00 committed by Ben Walker
parent 4640f32482
commit ae7b5890ef

View File

@ -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