From 8335f41cda5fe927efd533f1495a451bc871ef43 Mon Sep 17 00:00:00 2001 From: Steven Cooreman Date: Tue, 2 Jun 2020 11:04:15 +0200 Subject: [PATCH] Enable figuring out number of cores when running on OS X Signed-off-by: Steven Cooreman --- tests/scripts/docker_env.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/scripts/docker_env.sh b/tests/scripts/docker_env.sh index 8bdc425796..582a17d1a4 100755 --- a/tests/scripts/docker_env.sh +++ b/tests/scripts/docker_env.sh @@ -60,12 +60,19 @@ else DOCKER="sudo docker" fi +# Figure out the number of processors available +if [ "$(uname)" == "Darwin" ]; then + NUM_PROC="$(sysctl -n hw.logicalcpu)" +else + NUM_PROC="$(nproc)" +fi + # Build the Docker image echo "Getting docker image up to date (this may take a few minutes)..." ${DOCKER} image build \ -t ${DOCKER_IMAGE_TAG} \ --cache-from=${DOCKER_IMAGE_TAG} \ - --build-arg MAKEFLAGS_PARALLEL="-j $(nproc)" \ + --build-arg MAKEFLAGS_PARALLEL="-j ${NUM_PROC}" \ --network host \ ${http_proxy+--build-arg http_proxy=${http_proxy}} \ ${https_proxy+--build-arg https_proxy=${https_proxy}} \