Debian Codegraph @

tools/run_tests/dockerize/docker_run.sh

raw
1 #!/bin/bash
2 # Copyright 2016 The 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 build_and_run_docker.sh inside a docker
17 # container. You should never need to call this script on your own.
18
19 set -e
20
21 if [ "${RELATIVE_COPY_PATH}" == "" ]
22 then
23 mkdir -p /var/local/git
24 git clone "${EXTERNAL_GIT_ROOT}" /var/local/git/grpc
25 # clone gRPC submodules, use data from locally cloned submodules where possible
26 # TODO: figure out a way to eliminate this following shellcheck suppressions
27 # shellcheck disable=SC2016,SC1004
28 (cd "${EXTERNAL_GIT_ROOT}" && git submodule foreach 'git clone ${EXTERNAL_GIT_ROOT}/${name} /var/local/git/grpc/${name}')
29 (cd /var/local/git/grpc && git submodule init)
30 else
31 mkdir -p "/var/local/git/grpc/${RELATIVE_COPY_PATH}"
32 cp -r "${EXTERNAL_GIT_ROOT}/${RELATIVE_COPY_PATH}"/* "/var/local/git/grpc/${RELATIVE_COPY_PATH}"
33 fi
34
35 cd /var/local/git/grpc
36
37 # whatever is written to the reports/ dir will be made available outside of the docker container.
38 ln -s "${EXTERNAL_GIT_ROOT}/reports" reports
39 # if OUTPUT_DIR is specified, whatever is written to ./${OUTPUT_DIR}/ will be made available outside of the docker container.
40 if [ "${OUTPUT_DIR}" != "" ]
41 then
42 ln -s "${EXTERNAL_GIT_ROOT}/${OUTPUT_DIR}" "${OUTPUT_DIR}"
43 fi
44
45 exit_code=0
46 ${DOCKER_RUN_SCRIPT_COMMAND} || exit_code=$?
47
48 if [ -x "$(command -v ccache)" ]
49 then
50 ccache --show-stats || true
51 fi
52
53 exit $exit_code