Merge pull request #19664 from rmstar/cfstream_test_sanitizers

Run cfstream_test under ASAN and TSAN
diff --git a/tools/bazel.rc b/tools/bazel.rc
index 7a716e8..411457a 100644
--- a/tools/bazel.rc
+++ b/tools/bazel.rc
@@ -13,6 +13,9 @@
 build:dbg --compilation_mode=dbg
 
 build:asan --strip=never
+# Workaround for https://github.com/bazelbuild/bazel/issues/6932
+build:asan --copt -Wno-macro-redefined
+build:asan --copt -D_FORTIFY_SOURCE=0
 build:asan --copt=-fsanitize=address
 build:asan --copt=-O0
 build:asan --copt=-fno-omit-frame-pointer
diff --git a/tools/internal_ci/macos/grpc_cfstream_asan.cfg b/tools/internal_ci/macos/grpc_cfstream_asan.cfg
new file mode 100644
index 0000000..ceff78a
--- /dev/null
+++ b/tools/internal_ci/macos/grpc_cfstream_asan.cfg
@@ -0,0 +1,23 @@
+# Copyright 2019 The gRPC Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Config file for the internal CI (in protobuf text format)
+
+# Location of the continuous shell script in repository.
+build_file: "grpc/tools/internal_ci/macos/grpc_run_bazel_tests.sh"
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "--config=asan"
+}
+
diff --git a/tools/internal_ci/macos/grpc_cfstream_tsan.cfg b/tools/internal_ci/macos/grpc_cfstream_tsan.cfg
new file mode 100644
index 0000000..52f1f3e
--- /dev/null
+++ b/tools/internal_ci/macos/grpc_cfstream_tsan.cfg
@@ -0,0 +1,23 @@
+# Copyright 2019 The gRPC Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Config file for the internal CI (in protobuf text format)
+
+# Location of the continuous shell script in repository.
+build_file: "grpc/tools/internal_ci/macos/grpc_run_bazel_tests.sh"
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "--config=tsan"
+}
+
diff --git a/tools/internal_ci/macos/grpc_run_bazel_tests.sh b/tools/internal_ci/macos/grpc_run_bazel_tests.sh
index 56fae8f..c64dcc5 100644
--- a/tools/internal_ci/macos/grpc_run_bazel_tests.sh
+++ b/tools/internal_ci/macos/grpc_run_bazel_tests.sh
@@ -29,7 +29,7 @@
 ./tools/run_tests/start_port_server.py
 
 # run cfstream_test separately because it messes with the network
-bazel test --spawn_strategy=standalone --genrule_strategy=standalone --test_output=all //test/cpp/end2end:cfstream_test
+bazel test $RUN_TESTS_FLAGS --spawn_strategy=standalone --genrule_strategy=standalone --test_output=all //test/cpp/end2end:cfstream_test
 
 # kill port_server.py to prevent the build from hanging
 ps aux | grep port_server\\.py | awk '{print $2}' | xargs kill -9