Change how numProc is derived on Linux (dotnet/coreclr#13909)
authorJarret Shook <jashoo@microsoft.com>
Wed, 13 Sep 2017 08:43:06 +0000 (01:43 -0700)
committerJan Vorlicek <janvorli@microsoft.com>
Wed, 13 Sep 2017 08:43:06 +0000 (10:43 +0200)
Before the decision for numProcs to run in parallel for runtests.sh
was based on _NPROCESSORS_ONLN which harware which attempts to save
power (eg arm(64)) this number may be < numProcs.

Commit migrated from https://github.com/dotnet/coreclr/commit/80dd47bb5564f1cfc843c8d753096a0a3acfbe2d

src/coreclr/build.sh
src/coreclr/tests/runtest.sh

index d5a35d2..97a11c2 100755 (executable)
@@ -643,8 +643,10 @@ if [ `uname` = "FreeBSD" ]; then
   __NumProc=`sysctl hw.ncpu | awk '{ print $2+1 }'`
 elif [ `uname` = "NetBSD" ]; then
   __NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
-else
+elif [ `uname` = "Darwin" ]; then
   __NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
+else
+  __NumProc=$(nproc --all)
 fi
 
 while :; do
index fdc067e..e238723 100755 (executable)
@@ -733,8 +733,10 @@ function run_test {
 # Variables for running tests in the background
 if [ `uname` = "NetBSD" ]; then
     NumProc=$(getconf NPROCESSORS_ONLN)
-else
+elif [ `uname` = "Darwin" ]; then
     NumProc=$(getconf _NPROCESSORS_ONLN)
+else
+    NumProc=$(nproc --all)
 fi
 ((maxProcesses = $NumProc * 3 / 2)) # long tests delay process creation, use a few more processors