1#!/bin/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# Build portability tests with an updated submodule 17 18set -ex 19 20# change to grpc repo root 21cd $(dirname $0)/../../.. 22 23source tools/internal_ci/helper_scripts/prepare_build_linux_rc 24 25# Submodule name is passed as the RUN_TESTS_FLAGS variable 26SUBMODULE_NAME="${RUN_TESTS_FLAGS}" 27 28# Name of branch to checkout is passed as BAZEL_FLAGS variable 29# If unset, "master" is used by default. 30SUBMODULE_BRANCH_NAME="${BAZEL_FLAGS:-master}" 31 32# Update submodule to be tested at HEAD 33(cd "third_party/${SUBMODULE_NAME}" && git fetch origin && git checkout "origin/${SUBMODULE_BRANCH_NAME}") 34 35echo "This suite tests whether gRPC HEAD builds with HEAD of submodule '${SUBMODULE_NAME}'" 36echo "If a test breaks, either" 37echo "1) some change in the grpc repository has caused the failure" 38echo "2) some change that was just merged in the submodule head has caused the failure." 39echo "" 40echo "submodule '${SUBMODULE_NAME}' is at commit: $(cd third_party/${SUBMODULE_NAME}; git rev-parse --verify HEAD)" 41echo "" 42 43# Update bazel for generate_projects 44case "$SUBMODULE_NAME" in 45 abseil-cpp) 46 BAZEL_DEP_NAME="com_google_absl" 47 ;; 48 boringssl) 49 BAZEL_DEP_NAME="boringssl" 50 ;; 51 protobuf) 52 BAZEL_DEP_NAME="com_google_protobuf" 53 ;; 54esac 55if [ -z "$BAZEL_DEP_NAME" ] 56then 57 echo "No bazel dependency is specified so skipping bazel reconfiguration." 58else 59 BAZEL_DEP_PATH="$(pwd)/third_party/${SUBMODULE_NAME}" 60 echo "bazel override_repository is set for ${BAZEL_DEP_NAME} to ${BAZEL_DEP_PATH}" 61 echo "build --override_repository=${BAZEL_DEP_NAME}=${BAZEL_DEP_PATH}" >> "tools/bazel.rc" 62 echo "query --override_repository=${BAZEL_DEP_NAME}=${BAZEL_DEP_PATH}" >> "tools/bazel.rc" 63fi 64echo "" 65 66if [ "${SUBMODULE_NAME}" == "abseil-cpp" ] 67then 68 src/abseil-cpp/preprocessed_builds.yaml.gen.py 69fi 70 71if [ "${SUBMODULE_NAME}" == "protobuf" ] 72then 73 # update upb 74 rm -rf third_party/upb/upb 75 cp -r third_party/protobuf/upb third_party/upb 76 # generate upb gen source codes 77 export CC=gcc 78 tools/codegen/core/gen_upb_api.sh 79 # update utf8_range 80 rm -rf third_party/utf8_range 81 cp -r third_party/protobuf/third_party/utf8_range third_party/utf8_range/ 82fi 83 84tools/buildgen/generate_projects.sh 85 86# commit so that changes are passed to Docker 87git add -A 88git -c user.name='foo' -c user.email='foo@google.com' commit -m 'Update submodule' --allow-empty 89 90tools/run_tests/run_tests_matrix.py -f linux --exclude c sanity basictests_arm64 openssl dbg --inner_jobs 16 -j 2 --build_only 91