• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env bash
2# Copyright 2017 gRPC authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16# This script is invoked by a pull request job and executes all
17# args passed to this script if the pull request affect C/C++ code
18set -ex
19
20# Enter the gRPC repo root
21cd $(dirname $0)/../../..
22
23# TODO(jtattermusch): the "ghprbTargetBranch" is Jenkins specific and probably
24# does not work on kokoro?
25AFFECTS_C_CPP=`python -c 'import os; \
26               import sys; \
27               sys.path.insert(0, "tools/run_tests/python_utils"); \
28               import filter_pull_request_tests as filter; \
29               github_target_branch = os.environ.get("ghprbTargetBranch"); \
30               print(filter.affects_c_cpp("origin/%s" % github_target_branch))'`
31
32if [ $AFFECTS_C_CPP == "False" ] ; then
33  echo "This pull request does not affect C/C++. Tests do not need to be run."
34else
35  $@
36fi
37