From cff61fb813e7759e9c82b4c8b51a0d036ad478bb Mon Sep 17 00:00:00 2001 From: Xiaoquan Kong Date: Thu, 4 Apr 2019 11:23:15 +0800 Subject: [PATCH] Add Mac OS X test supporting: addons_cpu.sh cannot work correctly on Mac OS X system due to cannot get CPU core number correctly. this commit fix it. --- tools/ci_testing/addons_cpu.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/ci_testing/addons_cpu.sh b/tools/ci_testing/addons_cpu.sh index 28411ef77c..0882840b3e 100644 --- a/tools/ci_testing/addons_cpu.sh +++ b/tools/ci_testing/addons_cpu.sh @@ -24,7 +24,14 @@ fi set -x -N_JOBS=$(grep -c ^processor /proc/cpuinfo) +PLATFORM="$(uname -s | tr 'A-Z' 'a-z')" + +if [[ ${PLATFORM} == "darwin" ]]; then + N_JOBS=$(sysctl -n hw.ncpu) +else + N_JOBS=$(grep -c ^processor /proc/cpuinfo) +fi + echo "" echo "Bazel will use ${N_JOBS} concurrent job(s)."