Debian Codegraph @

tools/run_tests/helper_scripts/run_tests_in_workspace.sh

raw
1 #!/bin/bash
2 # Copyright 2015 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 # Create a workspace in a subdirectory to allow running multiple builds in isolation.
17 # WORKSPACE_NAME env variable needs to contain name of the workspace to create.
18 # All cmdline args will be passed to run_tests.py script (executed in the
19 # newly created workspace)
20 set -ex
21
22 cd "$(dirname "$0")/../../.."
23 repo_root="$(pwd)"
24 export repo_root
25
26 rm -rf "${WORKSPACE_NAME}"
27 git clone . "${WORKSPACE_NAME}"
28 # clone gRPC submodules, use data from locally cloned submodules where possible
29 # shellcheck disable=SC2016,SC1004
30 git submodule foreach 'cd "${repo_root}/${WORKSPACE_NAME}" \
31 && git submodule update --init --reference ${repo_root}/${name} ${name}'
32
33 echo "Running run_tests.py in workspace ${WORKSPACE_NAME}"
34 python3 "${WORKSPACE_NAME}/tools/run_tests/run_tests.py" "$@"