From 138c52cf7b5ab984bf3975e2a7a17f20960becee Mon Sep 17 00:00:00 2001
From: Matt Kwong <mattkwong@google.com>
Date: Mon, 12 Jun 2017 10:37:53 -0700
Subject: [PATCH] Use one shell script for all run_tests_matrix on Kokoro

---
 tools/internal_ci/linux/grpc_master.cfg       |  7 +++++-
 tools/internal_ci/linux/grpc_master.sh        | 23 -------------------
 tools/internal_ci/linux/grpc_portability.cfg  |  7 +++++-
 tools/internal_ci/linux/grpc_portability.sh   | 23 -------------------
 .../linux/grpc_portability_build_only.cfg     |  7 +++++-
 .../linux/grpc_pull_request_sanity.cfg        |  7 +++++-
 ...build_only.sh => grpc_run_tests_matrix.sh} |  2 +-
 tools/internal_ci/linux/grpc_sanity.cfg       |  7 +++++-
 tools/internal_ci/linux/grpc_sanity.sh        | 23 -------------------
 .../linux/sanitizer/grpc_c_asan.cfg           |  7 +++++-
 .../linux/sanitizer/grpc_c_asan.sh            | 23 -------------------
 .../linux/sanitizer/grpc_c_msan.cfg           |  7 +++++-
 .../linux/sanitizer/grpc_c_msan.sh            | 23 -------------------
 .../linux/sanitizer/grpc_c_tsan.cfg           |  7 +++++-
 .../linux/sanitizer/grpc_c_tsan.sh            | 23 -------------------
 .../linux/sanitizer/grpc_c_ubsan.cfg          |  7 +++++-
 .../linux/sanitizer/grpc_c_ubsan.sh           | 23 -------------------
 .../linux/sanitizer/grpc_cpp_asan.cfg         |  7 +++++-
 .../linux/sanitizer/grpc_cpp_asan.sh          | 23 -------------------
 .../linux/sanitizer/grpc_cpp_tsan.cfg         |  7 +++++-
 .../linux/sanitizer/grpc_cpp_tsan.sh          | 23 -------------------
 .../sanitizer/pull_request/grpc_c_asan.cfg    |  7 +++++-
 .../sanitizer/pull_request/grpc_c_msan.cfg    |  7 +++++-
 .../sanitizer/pull_request/grpc_c_tsan.cfg    |  7 +++++-
 .../sanitizer/pull_request/grpc_c_ubsan.cfg   |  7 +++++-
 .../sanitizer/pull_request/grpc_cpp_asan.cfg  |  7 +++++-
 .../sanitizer/pull_request/grpc_cpp_tsan.cfg  |  7 +++++-
 27 files changed, 103 insertions(+), 225 deletions(-)
 delete mode 100755 tools/internal_ci/linux/grpc_master.sh
 delete mode 100755 tools/internal_ci/linux/grpc_portability.sh
 rename tools/internal_ci/linux/{grpc_portability_build_only.sh => grpc_run_tests_matrix.sh} (89%)
 delete mode 100755 tools/internal_ci/linux/grpc_sanity.sh
 delete mode 100755 tools/internal_ci/linux/sanitizer/grpc_c_asan.sh
 delete mode 100755 tools/internal_ci/linux/sanitizer/grpc_c_msan.sh
 delete mode 100755 tools/internal_ci/linux/sanitizer/grpc_c_tsan.sh
 delete mode 100755 tools/internal_ci/linux/sanitizer/grpc_c_ubsan.sh
 delete mode 100755 tools/internal_ci/linux/sanitizer/grpc_cpp_asan.sh
 delete mode 100755 tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.sh

diff --git a/tools/internal_ci/linux/grpc_master.cfg b/tools/internal_ci/linux/grpc_master.cfg
index 7447f20d6d..8bcc668ba9 100644
--- a/tools/internal_ci/linux/grpc_master.cfg
+++ b/tools/internal_ci/linux/grpc_master.cfg
@@ -15,10 +15,15 @@
 # Config file for the internal CI (in protobuf text format)
 
 # Location of the continuous shell script in repository.
-build_file: "grpc/tools/internal_ci/linux/grpc_master.sh"
+build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh"
 timeout_mins: 240
 action {
   define_artifacts {
     regex: "**/*sponge_log.xml"
   }
 }
+
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "-f basictests linux --inner_jobs 16 -j 1 --internal_ci --bq_result_table aggregate_results"
+}
diff --git a/tools/internal_ci/linux/grpc_master.sh b/tools/internal_ci/linux/grpc_master.sh
deleted file mode 100755
index c875260aea..0000000000
--- a/tools/internal_ci/linux/grpc_master.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Copyright 2017 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.
-
-set -ex
-
-# change to grpc repo root
-cd $(dirname $0)/../../..
-
-source tools/internal_ci/helper_scripts/prepare_build_linux_rc
-
-tools/run_tests/run_tests_matrix.py -f basictests linux --inner_jobs 16 -j 1 --internal_ci --bq_result_table aggregate_results
diff --git a/tools/internal_ci/linux/grpc_portability.cfg b/tools/internal_ci/linux/grpc_portability.cfg
index a61b8cda8c..c5bfd3bb40 100644
--- a/tools/internal_ci/linux/grpc_portability.cfg
+++ b/tools/internal_ci/linux/grpc_portability.cfg
@@ -15,10 +15,15 @@
 # Config file for the internal CI (in protobuf text format)
 
 # Location of the continuous shell script in repository.
-build_file: "grpc/tools/internal_ci/linux/grpc_portability.sh"
+build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh"
 timeout_mins: 1440
 action {
   define_artifacts {
     regex: "**/*sponge_log.xml"
   }
 }
+
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "-f portability linux --inner_jobs 16 -j 1 --internal_ci"
+}
diff --git a/tools/internal_ci/linux/grpc_portability.sh b/tools/internal_ci/linux/grpc_portability.sh
deleted file mode 100755
index 35b7dccb81..0000000000
--- a/tools/internal_ci/linux/grpc_portability.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Copyright 2017 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.
-
-set -ex
-
-# change to grpc repo root
-cd $(dirname $0)/../../..
-
-source tools/internal_ci/helper_scripts/prepare_build_linux_rc
-
-tools/run_tests/run_tests_matrix.py -f portability linux --inner_jobs 16 -j 1 --internal_ci
diff --git a/tools/internal_ci/linux/grpc_portability_build_only.cfg b/tools/internal_ci/linux/grpc_portability_build_only.cfg
index ebca54d4a1..fce914c612 100644
--- a/tools/internal_ci/linux/grpc_portability_build_only.cfg
+++ b/tools/internal_ci/linux/grpc_portability_build_only.cfg
@@ -15,10 +15,15 @@
 # Config file for the internal CI (in protobuf text format)
 
 # Location of the continuous shell script in repository.
-build_file: "grpc/tools/internal_ci/linux/grpc_portability_build_only.sh"
+build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh"
 timeout_mins: 180
 action {
   define_artifacts {
     regex: "**/*sponge_log.xml"
   }
 }
+
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "-f portability linux --internal_ci --build_only"
+}
diff --git a/tools/internal_ci/linux/grpc_pull_request_sanity.cfg b/tools/internal_ci/linux/grpc_pull_request_sanity.cfg
index 0ce2a1c459..6c76a929c0 100644
--- a/tools/internal_ci/linux/grpc_pull_request_sanity.cfg
+++ b/tools/internal_ci/linux/grpc_pull_request_sanity.cfg
@@ -15,10 +15,15 @@
 # Config file for the internal CI (in protobuf text format)
 
 # Location of the continuous shell script in repository.
-build_file: "grpc/tools/internal_ci/linux/grpc_sanity.sh"
+build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh"
 timeout_mins: 30
 action {
   define_artifacts {
     regex: "**/*sponge_log.xml"
   }
 }
+
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "-f basictests linux sanity opt --inner_jobs 16 -j 1 --internal_ci"
+}
diff --git a/tools/internal_ci/linux/grpc_portability_build_only.sh b/tools/internal_ci/linux/grpc_run_tests_matrix.sh
similarity index 89%
rename from tools/internal_ci/linux/grpc_portability_build_only.sh
rename to tools/internal_ci/linux/grpc_run_tests_matrix.sh
index c6a5c698bc..028704b3ff 100755
--- a/tools/internal_ci/linux/grpc_portability_build_only.sh
+++ b/tools/internal_ci/linux/grpc_run_tests_matrix.sh
@@ -20,4 +20,4 @@ cd $(dirname $0)/../../..
 
 source tools/internal_ci/helper_scripts/prepare_build_linux_rc
 
-tools/run_tests/run_tests_matrix.py -f portability linux --internal_ci --build_only
+tools/run_tests/run_tests_matrix.py $RUN_TESTS_FLAGS
diff --git a/tools/internal_ci/linux/grpc_sanity.cfg b/tools/internal_ci/linux/grpc_sanity.cfg
index d439ba1efe..8dfeda0d45 100644
--- a/tools/internal_ci/linux/grpc_sanity.cfg
+++ b/tools/internal_ci/linux/grpc_sanity.cfg
@@ -15,10 +15,15 @@
 # Config file for the internal CI (in protobuf text format)
 
 # Location of the continuous shell script in repository.
-build_file: "grpc/tools/internal_ci/linux/grpc_sanity.sh"
+build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh"
 timeout_mins: 20
 action {
   define_artifacts {
     regex: "**/*sponge_log.xml"
   }
 }
+
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "-f basictests linux sanity opt --inner_jobs 16 -j 1 --internal_ci"
+}
diff --git a/tools/internal_ci/linux/grpc_sanity.sh b/tools/internal_ci/linux/grpc_sanity.sh
deleted file mode 100755
index 88bb291ab0..0000000000
--- a/tools/internal_ci/linux/grpc_sanity.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Copyright 2017 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.
-
-set -ex
-
-# change to grpc repo root
-cd $(dirname $0)/../../..
-
-source tools/internal_ci/helper_scripts/prepare_build_linux_rc
-
-tools/run_tests/run_tests_matrix.py -f basictests linux sanity opt --inner_jobs 16 -j 1 --internal_ci
diff --git a/tools/internal_ci/linux/sanitizer/grpc_c_asan.cfg b/tools/internal_ci/linux/sanitizer/grpc_c_asan.cfg
index 2870b08387..c4beaacf6b 100644
--- a/tools/internal_ci/linux/sanitizer/grpc_c_asan.cfg
+++ b/tools/internal_ci/linux/sanitizer/grpc_c_asan.cfg
@@ -15,10 +15,15 @@
 # Config file for the internal CI (in protobuf text format)
 
 # Location of the continuous shell script in repository.
-build_file: "grpc/tools/internal_ci/linux/sanitizer/grpc_c_asan.sh"
+build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh"
 timeout_mins: 1440
 action {
   define_artifacts {
     regex: "**/*sponge_log.xml"
   }
 }
+
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "-f c asan --inner_jobs 16 -j 1 --internal_ci --bq_result_table aggregate_results"
+}
diff --git a/tools/internal_ci/linux/sanitizer/grpc_c_asan.sh b/tools/internal_ci/linux/sanitizer/grpc_c_asan.sh
deleted file mode 100755
index 2ba6b3a45d..0000000000
--- a/tools/internal_ci/linux/sanitizer/grpc_c_asan.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Copyright 2017 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.
-
-set -ex
-
-# change to grpc repo root
-cd $(dirname $0)/../../../..
-
-source tools/internal_ci/helper_scripts/prepare_build_linux_rc
-
-tools/run_tests/run_tests_matrix.py -f c asan --inner_jobs 16 -j 1 --internal_ci --bq_result_table aggregate_results
diff --git a/tools/internal_ci/linux/sanitizer/grpc_c_msan.cfg b/tools/internal_ci/linux/sanitizer/grpc_c_msan.cfg
index 559d895f09..0197966f32 100644
--- a/tools/internal_ci/linux/sanitizer/grpc_c_msan.cfg
+++ b/tools/internal_ci/linux/sanitizer/grpc_c_msan.cfg
@@ -15,10 +15,15 @@
 # Config file for the internal CI (in protobuf text format)
 
 # Location of the continuous shell script in repository.
-build_file: "grpc/tools/internal_ci/linux/sanitizer/grpc_c_msan.sh"
+build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh"
 timeout_mins: 1440
 action {
   define_artifacts {
     regex: "**/*sponge_log.xml"
   }
 }
+
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "-f c msan --inner_jobs 16 -j 1 --internal_ci --bq_result_table aggregate_results"
+}
diff --git a/tools/internal_ci/linux/sanitizer/grpc_c_msan.sh b/tools/internal_ci/linux/sanitizer/grpc_c_msan.sh
deleted file mode 100755
index e9e88f60c6..0000000000
--- a/tools/internal_ci/linux/sanitizer/grpc_c_msan.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Copyright 2017 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.
-
-set -ex
-
-# change to grpc repo root
-cd $(dirname $0)/../../../..
-
-source tools/internal_ci/helper_scripts/prepare_build_linux_rc
-
-tools/run_tests/run_tests_matrix.py -f c msan --inner_jobs 16 -j 1 --internal_ci --bq_result_table aggregate_results
diff --git a/tools/internal_ci/linux/sanitizer/grpc_c_tsan.cfg b/tools/internal_ci/linux/sanitizer/grpc_c_tsan.cfg
index c24671926c..243eb99fbb 100644
--- a/tools/internal_ci/linux/sanitizer/grpc_c_tsan.cfg
+++ b/tools/internal_ci/linux/sanitizer/grpc_c_tsan.cfg
@@ -15,10 +15,15 @@
 # Config file for the internal CI (in protobuf text format)
 
 # Location of the continuous shell script in repository.
-build_file: "grpc/tools/internal_ci/linux/sanitizer/grpc_c_tsan.sh"
+build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh"
 timeout_mins: 1440
 action {
   define_artifacts {
     regex: "**/*sponge_log.xml"
   }
 }
+
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "-f c tsan --inner_jobs 16 -j 1 --internal_ci --bq_result_table aggregate_results"
+}
diff --git a/tools/internal_ci/linux/sanitizer/grpc_c_tsan.sh b/tools/internal_ci/linux/sanitizer/grpc_c_tsan.sh
deleted file mode 100755
index fd14375fb1..0000000000
--- a/tools/internal_ci/linux/sanitizer/grpc_c_tsan.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Copyright 2017 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.
-
-set -ex
-
-# change to grpc repo root
-cd $(dirname $0)/../../../..
-
-source tools/internal_ci/helper_scripts/prepare_build_linux_rc
-
-tools/run_tests/run_tests_matrix.py -f c tsan --inner_jobs 16 -j 1 --internal_ci --bq_result_table aggregate_results
diff --git a/tools/internal_ci/linux/sanitizer/grpc_c_ubsan.cfg b/tools/internal_ci/linux/sanitizer/grpc_c_ubsan.cfg
index 9f3eca60c4..24c7bf8a4c 100644
--- a/tools/internal_ci/linux/sanitizer/grpc_c_ubsan.cfg
+++ b/tools/internal_ci/linux/sanitizer/grpc_c_ubsan.cfg
@@ -15,10 +15,15 @@
 # Config file for the internal CI (in protobuf text format)
 
 # Location of the continuous shell script in repository.
-build_file: "grpc/tools/internal_ci/linux/sanitizer/grpc_c_ubsan.sh"
+build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh"
 timeout_mins: 1440
 action {
   define_artifacts {
     regex: "**/*sponge_log.xml"
   }
 }
+
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "-f c ubsan --inner_jobs 16 -j 1 --internal_ci --bq_result_table aggregate_results"
+}
diff --git a/tools/internal_ci/linux/sanitizer/grpc_c_ubsan.sh b/tools/internal_ci/linux/sanitizer/grpc_c_ubsan.sh
deleted file mode 100755
index 89c720951c..0000000000
--- a/tools/internal_ci/linux/sanitizer/grpc_c_ubsan.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Copyright 2017 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.
-
-set -ex
-
-# change to grpc repo root
-cd $(dirname $0)/../../../..
-
-source tools/internal_ci/helper_scripts/prepare_build_linux_rc
-
-tools/run_tests/run_tests_matrix.py -f c ubsan --inner_jobs 16 -j 1 --internal_ci --bq_result_table aggregate_results
diff --git a/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.cfg b/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.cfg
index 796fdfe97f..f12366cb0a 100644
--- a/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.cfg
+++ b/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.cfg
@@ -15,10 +15,15 @@
 # Config file for the internal CI (in protobuf text format)
 
 # Location of the continuous shell script in repository.
-build_file: "grpc/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.sh"
+build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh"
 timeout_mins: 1440
 action {
   define_artifacts {
     regex: "**/*sponge_log.xml"
   }
 }
+
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "-f c++ asan --inner_jobs 16 -j 1 --internal_ci --bq_result_table aggregate_results"
+}
diff --git a/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.sh b/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.sh
deleted file mode 100755
index e0e0381a99..0000000000
--- a/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Copyright 2017 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.
-
-set -ex
-
-# change to grpc repo root
-cd $(dirname $0)/../../../..
-
-source tools/internal_ci/helper_scripts/prepare_build_linux_rc
-
-tools/run_tests/run_tests_matrix.py -f c++ asan --inner_jobs 16 -j 1 --internal_ci --bq_result_table aggregate_results
diff --git a/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.cfg b/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.cfg
index 7889195173..ca807aed16 100644
--- a/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.cfg
+++ b/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.cfg
@@ -15,10 +15,15 @@
 # Config file for the internal CI (in protobuf text format)
 
 # Location of the continuous shell script in repository.
-build_file: "grpc/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.sh"
+build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh"
 timeout_mins: 1440
 action {
   define_artifacts {
     regex: "**/*sponge_log.xml"
   }
 }
+
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "-f c++ tsan --inner_jobs 16 -j 1 --internal_ci --bq_result_table aggregate_results"
+}
diff --git a/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.sh b/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.sh
deleted file mode 100755
index 27aa08f1d4..0000000000
--- a/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Copyright 2017 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.
-
-set -ex
-
-# change to grpc repo root
-cd $(dirname $0)/../../../..
-
-source tools/internal_ci/helper_scripts/prepare_build_linux_rc
-
-tools/run_tests/run_tests_matrix.py -f c++ tsan --inner_jobs 16 -j 1 --internal_ci --bq_result_table aggregate_results
diff --git a/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_asan.cfg b/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_asan.cfg
index 00157cc6fa..98eb4d0139 100644
--- a/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_asan.cfg
+++ b/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_asan.cfg
@@ -16,10 +16,15 @@
 # Config file for the internal CI (in protobuf text format)
 
 # Location of the continuous shell script in repository.
-build_file: "grpc/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_asan.sh"
+build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh"
 timeout_mins: 1440
 action {
   define_artifacts {
     regex: "**/*sponge_log.xml"
   }
 }
+
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "-f c asan --inner_jobs 16 -j 1 --internal_ci --filter_pr_tests --base_branch origin/master --max_time=3600"
+}
diff --git a/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_msan.cfg b/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_msan.cfg
index a278111fec..e47762ca88 100644
--- a/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_msan.cfg
+++ b/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_msan.cfg
@@ -16,10 +16,15 @@
 # Config file for the internal CI (in protobuf text format)
 
 # Location of the continuous shell script in repository.
-build_file: "grpc/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_msan.sh"
+build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh"
 timeout_mins: 1440
 action {
   define_artifacts {
     regex: "**/*sponge_log.xml"
   }
 }
+
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "-f c msan --inner_jobs 16 -j 1 --internal_ci --filter_pr_tests --base_branch origin/master --max_time=3600"
+}
diff --git a/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_tsan.cfg b/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_tsan.cfg
index 2ca6d71e9b..c3803aff56 100644
--- a/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_tsan.cfg
+++ b/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_tsan.cfg
@@ -16,10 +16,15 @@
 # Config file for the internal CI (in protobuf text format)
 
 # Location of the continuous shell script in repository.
-build_file: "grpc/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_tsan.sh"
+build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh"
 timeout_mins: 1440
 action {
   define_artifacts {
     regex: "**/*sponge_log.xml"
   }
 }
+
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "-f c tsan --inner_jobs 16 -j 1 --internal_ci --filter_pr_tests --base_branch origin/master --max_time=3600"
+}
diff --git a/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_ubsan.cfg b/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_ubsan.cfg
index 2c3df5eab7..831cfb53ba 100644
--- a/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_ubsan.cfg
+++ b/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_ubsan.cfg
@@ -16,10 +16,15 @@
 # Config file for the internal CI (in protobuf text format)
 
 # Location of the continuous shell script in repository.
-build_file: "grpc/tools/internal_ci/linux/sanitizer/pull_request/grpc_c_ubsan.sh"
+build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh"
 timeout_mins: 1440
 action {
   define_artifacts {
     regex: "**/*sponge_log.xml"
   }
 }
+
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "-f c ubsan --inner_jobs 16 -j 1 --internal_ci --filter_pr_tests --base_branch origin/master --max_time=3600"
+}
diff --git a/tools/internal_ci/linux/sanitizer/pull_request/grpc_cpp_asan.cfg b/tools/internal_ci/linux/sanitizer/pull_request/grpc_cpp_asan.cfg
index 5d79e2649e..c332443182 100644
--- a/tools/internal_ci/linux/sanitizer/pull_request/grpc_cpp_asan.cfg
+++ b/tools/internal_ci/linux/sanitizer/pull_request/grpc_cpp_asan.cfg
@@ -16,10 +16,15 @@
 # Config file for the internal CI (in protobuf text format)
 
 # Location of the continuous shell script in repository.
-build_file: "grpc/tools/internal_ci/linux/sanitizer/pull_request/grpc_cpp_asan.sh"
+build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh"
 timeout_mins: 1440
 action {
   define_artifacts {
     regex: "**/*sponge_log.xml"
   }
 }
+
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "-f c++ asan --inner_jobs 16 -j 1 --internal_ci --filter_pr_tests --base_branch origin/master --max_time=3600"
+}
diff --git a/tools/internal_ci/linux/sanitizer/pull_request/grpc_cpp_tsan.cfg b/tools/internal_ci/linux/sanitizer/pull_request/grpc_cpp_tsan.cfg
index fb6cf5adac..92cd93fcac 100644
--- a/tools/internal_ci/linux/sanitizer/pull_request/grpc_cpp_tsan.cfg
+++ b/tools/internal_ci/linux/sanitizer/pull_request/grpc_cpp_tsan.cfg
@@ -16,10 +16,15 @@
 # Config file for the internal CI (in protobuf text format)
 
 # Location of the continuous shell script in repository.
-build_file: "grpc/tools/internal_ci/linux/sanitizer/pull_request/grpc_cpp_tsan.sh"
+build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh"
 timeout_mins: 1440
 action {
   define_artifacts {
     regex: "**/*sponge_log.xml"
   }
 }
+
+env_vars {
+  key: "RUN_TESTS_FLAGS"
+  value: "-f c++ tsan --inner_jobs 16 -j 1 --internal_ci --filter_pr_tests --base_branch origin/master --max_time=3600"
+}
-- 
GitLab