From 3e301a37bcc1a1d4e34caf2fbb446e4e26e1f8a8 Mon Sep 17 00:00:00 2001
From: Craig Tiller <ctiller@google.com>
Date: Wed, 27 Jan 2016 15:36:52 -0800
Subject: [PATCH] Reduce CPU, increase MSAN timeouts

---
 Makefile                     |  2 +-
 build.yaml                   |  2 +-
 tools/jenkins/run_jenkins.sh | 11 +++++++----
 tools/run_tests/configs.json |  2 +-
 tools/run_tests/jobset.py    |  2 +-
 5 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 8dfb505424..0ba7067973 100644
--- a/Makefile
+++ b/Makefile
@@ -208,7 +208,7 @@ CFLAGS_msan = -O0 -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-fr
 CXXFLAGS_msan = -O0 -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -Wno-unused-command-line-argument -fPIE -pie
 LDFLAGS_msan = -fsanitize=memory -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -fPIE -pie $(if $(JENKINS_BUILD),-Wl$(comma)-Ttext-segment=0x7e0000000000,)
 DEFINES_msan = NDEBUG
-DEFINES_msan += GRPC_TEST_SLOWDOWN_BUILD_FACTOR=1.5
+DEFINES_msan += GRPC_TEST_SLOWDOWN_BUILD_FACTOR=2
 
 VALID_CONFIG_mutrace = 1
 CC_mutrace = $(DEFAULT_CC)
diff --git a/build.yaml b/build.yaml
index 36b031003a..8655027363 100644
--- a/build.yaml
+++ b/build.yaml
@@ -2561,7 +2561,7 @@ configs:
       -fPIE -pie $(if $(JENKINS_BUILD),-Wl$(comma)-Ttext-segment=0x7e0000000000,)
     LDXX: clang++
     compile_the_world: true
-    timeout_multiplier: 1.5
+    timeout_multiplier: 2
   mutrace:
     CPPFLAGS: -O0
     DEFINES: _DEBUG DEBUG
diff --git a/tools/jenkins/run_jenkins.sh b/tools/jenkins/run_jenkins.sh
index 49b2fa55c2..c9bc4f1894 100755
--- a/tools/jenkins/run_jenkins.sh
+++ b/tools/jenkins/run_jenkins.sh
@@ -42,6 +42,9 @@ set -ex -o igncr || set -ex
 # Grabbing the machine's architecture
 arch=`uname -m`
 
+# Number of concurrent cores each executor should try and schedule
+EXECUTOR_CORES=2
+
 case $platform in
   i386)
     arch="i386"
@@ -54,7 +57,7 @@ if [ "$platform" == "linux" ]
 then
   echo "building $language on Linux"
 
-  ./tools/run_tests/run_tests.py --use_docker -t -l $language -c $config -x report.xml -j 3 $@ || TESTS_FAILED="true"
+  ./tools/run_tests/run_tests.py --use_docker -t -l $language -c $config -x report.xml -j $EXECUTOR_CORES $@ || TESTS_FAILED="true"
 
 elif [ "$platform" == "windows" ]
 then
@@ -63,7 +66,7 @@ then
   # Prevent msbuild from picking up "platform" env variable, which would break the build
   unset platform
 
-  python tools/run_tests/run_tests.py -t -l $language -c $config -x report.xml -j 3 $@ || TESTS_FAILED="true"
+  python tools/run_tests/run_tests.py -t -l $language -c $config -x report.xml -j $EXECUTOR_CORES $@ || TESTS_FAILED="true"
 
 elif [ "$platform" == "macos" ]
 then
@@ -72,13 +75,13 @@ then
   # Prevent msbuild from picking up "platform" env variable, which would break the build
   unset platform
 
-  ./tools/run_tests/run_tests.py -t -l $language -c $config -x report.xml -j 3 $@ || TESTS_FAILED="true"
+  ./tools/run_tests/run_tests.py -t -l $language -c $config -x report.xml -j $EXECUTOR_CORES $@ || TESTS_FAILED="true"
 
 elif [ "$platform" == "freebsd" ]
 then
   echo "building $language on FreeBSD"
 
-  MAKE=gmake ./tools/run_tests/run_tests.py -t -l $language -c $config -x report.xml -j 3 $@ || TESTS_FAILED="true"
+  MAKE=gmake ./tools/run_tests/run_tests.py -t -l $language -c $config -x report.xml -j $EXECUTOR_CORES $@ || TESTS_FAILED="true"
 
 else
   echo "Unknown platform $platform"
diff --git a/tools/run_tests/configs.json b/tools/run_tests/configs.json
index 769942df99..d508c6394c 100644
--- a/tools/run_tests/configs.json
+++ b/tools/run_tests/configs.json
@@ -59,7 +59,7 @@
   }, 
   {
     "config": "msan", 
-    "timeout_multiplier": 1.5
+    "timeout_multiplier": 2
   }, 
   {
     "config": "mutrace"
diff --git a/tools/run_tests/jobset.py b/tools/run_tests/jobset.py
index beeb99c0ae..adf178bb3c 100755
--- a/tools/run_tests/jobset.py
+++ b/tools/run_tests/jobset.py
@@ -360,7 +360,7 @@ class Jobset(object):
       if self.cancelled(): return False
       current_cpu_cost = self.cpu_cost()
       if current_cpu_cost == 0: break
-      if current_cpu_cost + spec.cpu_cost < self._maxjobs: break
+      if current_cpu_cost + spec.cpu_cost <= self._maxjobs: break
       self.reap()
     if self.cancelled(): return False
     if spec.hash_targets:
-- 
GitLab