Merge pull request #13208 from dgquintas/lb_poll2

Make the BG poller poll very frequently in LB tests
diff --git a/build.yaml b/build.yaml
index 04b1f93..47f2610 100644
--- a/build.yaml
+++ b/build.yaml
@@ -3716,6 +3716,8 @@
   - --benchmark_min_time=0
   benchmark: true
   defaults: benchmark
+  exclude_configs:
+  - tsan
   excluded_poll_engines:
   - poll
   - poll-cv
@@ -4749,7 +4751,6 @@
   - grpc_unsecure
   - gpr_test_util
   - gpr
-  timeout_seconds: 1200
 - name: transport_pid_controller_test
   build: test
   language: c++
diff --git a/grpc.gemspec b/grpc.gemspec
index 8f4c00b..2fe2536 100644
--- a/grpc.gemspec
+++ b/grpc.gemspec
@@ -28,7 +28,7 @@
   s.platform      = Gem::Platform::RUBY
 
   s.add_dependency 'google-protobuf', '~> 3.1'
-  s.add_dependency 'googleauth',      '~> 0.5.1'
+  s.add_dependency 'googleauth',      '>= 0.5.1', '< 0.7'
   s.add_dependency 'googleapis-common-protos-types', '~> 1.0.0'
 
   s.add_development_dependency 'bundler',            '~> 1.9'
diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc
index fa6d79c..0809d57 100644
--- a/src/core/lib/iomgr/ev_epollex_linux.cc
+++ b/src/core/lib/iomgr/ev_epollex_linux.cc
@@ -577,7 +577,6 @@
                                    grpc_pollset_worker *specific_worker) {
   pollable *p = specific_worker->pollable_obj;
   grpc_core::mu_guard lock(&p->mu);
-  GRPC_STATS_INC_POLLSET_KICK(exec_ctx);
   GPR_ASSERT(specific_worker != NULL);
   if (specific_worker->kicked) {
     if (GRPC_TRACER_ON(grpc_polling_trace)) {
@@ -619,6 +618,7 @@
 
 static grpc_error *pollset_kick(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
                                 grpc_pollset_worker *specific_worker) {
+  GRPC_STATS_INC_POLLSET_KICK(exec_ctx);
   if (GRPC_TRACER_ON(grpc_polling_trace)) {
     gpr_log(GPR_DEBUG,
             "PS:%p kick %p tls_pollset=%p tls_worker=%p pollset.root_worker=%p",
@@ -674,6 +674,7 @@
   grpc_pollset_worker *w = pollset->root_worker;
   if (w != NULL) {
     do {
+      GRPC_STATS_INC_POLLSET_KICK(exec_ctx);
       append_error(&error, kick_one_worker(exec_ctx, w), err_desc);
       w = w->links[PWLINK_POLLSET].next;
     } while (w != pollset->root_worker);
diff --git a/templates/grpc.gemspec.template b/templates/grpc.gemspec.template
index 215d5f9..fb54de1 100644
--- a/templates/grpc.gemspec.template
+++ b/templates/grpc.gemspec.template
@@ -30,7 +30,7 @@
     s.platform      = Gem::Platform::RUBY
 
     s.add_dependency 'google-protobuf', '~> 3.1'
-    s.add_dependency 'googleauth',      '~> 0.5.1'
+    s.add_dependency 'googleauth',      '>= 0.5.1', '< 0.7'
     s.add_dependency 'googleapis-common-protos-types', '~> 1.0.0'
 
     s.add_development_dependency 'bundler',            '~> 1.9'
diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_interop_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_interop_rc
index bb046de..6ecf51d 100644
--- a/tools/internal_ci/helper_scripts/prepare_build_macos_interop_rc
+++ b/tools/internal_ci/helper_scripts/prepare_build_macos_interop_rc
@@ -25,6 +25,7 @@
 cd /Users/kbuilder/workspace/grpc
 
 # Needed for identifying Docker image sha1
+brew update
 brew install md5sha1sum
 
 # Set up gRPC-Go and gRPC-Java to test
diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json
index 6c58eb5..5ba06bf 100644
--- a/tools/run_tests/generated/tests.json
+++ b/tools/run_tests/generated/tests.json
@@ -3224,7 +3224,9 @@
       "posix"
     ], 
     "cpu_cost": 1.0, 
-    "exclude_configs": [], 
+    "exclude_configs": [
+      "tsan"
+    ], 
     "exclude_iomgrs": [], 
     "excluded_poll_engines": [
       "poll", 
@@ -4388,7 +4390,6 @@
       "posix", 
       "windows"
     ], 
-    "timeout_seconds": 1200, 
     "uses_polling": true
   }, 
   {
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index c3d070a..209925b 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -296,23 +296,30 @@
         if resolver:
           env['GRPC_DNS_RESOLVER'] = resolver
         shortname_ext = '' if polling_strategy=='all' else ' GRPC_POLL_STRATEGY=%s' % polling_strategy
-        timeout_scaling = 1
-
-        if auto_timeout_scaling and polling_strategy == 'poll-cv':
-          timeout_scaling *= 5
-
         if polling_strategy in target.get('excluded_poll_engines', []):
           continue
 
-        # Scale overall test timeout if running under various sanitizers.
-        config = self.args.config
-        if auto_timeout_scaling and ('asan' in config
-                                     or config == 'msan'
-                                     or config == 'tsan'
-                                     or config == 'ubsan'
-                                     or config == 'helgrind'
-                                     or config == 'memcheck'):
-          timeout_scaling *= 20
+        timeout_scaling = 1
+        if auto_timeout_scaling:
+          config = self.args.config
+          if ('asan' in config
+              or config == 'msan'
+              or config == 'tsan'
+              or config == 'ubsan'
+              or config == 'helgrind'
+              or config == 'memcheck'):
+            # Scale overall test timeout if running under various sanitizers.
+            # scaling value is based on historical data analysis
+            timeout_scaling *= 3
+          elif polling_strategy == 'poll-cv':
+            # scale test timeout if running with poll-cv
+            # sanitizer and poll-cv scaling is not cumulative to ensure
+            # reasonable timeout values.
+            # TODO(jtattermusch): based on historical data and 5min default
+            # test timeout poll-cv scaling is currently not useful.
+            # Leaving here so it can be reintroduced if the default test timeout
+            # is decreased in the future.
+            timeout_scaling *= 1
 
         if self.config.build_config in target['exclude_configs']:
           continue