-
Notifications
You must be signed in to change notification settings - Fork 5.6k
/
Copy pathbazel_coverage.sh
36 lines (26 loc) · 1.15 KB
/
bazel_coverage.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# TODO (SERVER-94776): Expose a reusable bazel command processor
# Usage:
# bazel_coverage [arguments]
#
# Required environment variables:
# * ${target} - Build target
# * ${args} - Extra command line args to pass to "bazel coverage"
# Needed for evergreen scripts that use evergreen expansions and utility methods.
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)"
. "$DIR/prelude.sh"
cd src
set -o errexit
set -o verbose
# Use `eval` to force evaluation of the environment variables in the echo statement:
eval echo "Execution environment: Args: ${args} Target: ${target}"
# We only support explicitly limited arch for code coverage, so there
# are fewer conditionals here than elsewhere in more general utilities.
BAZEL_BINARY=bazel
# Print command being run to file that can be uploaded
echo "python buildscripts/install_bazel.py" > bazel-invocation.txt
# TODO(SERVER-99431): Remove when bazel test timeouts are under control
set +e
echo " bazel coverage ${args} ${target}" >> bazel-invocation.txt
# use eval since some flags have quotes-in-quotes that are otherwise misintepreted
eval $BAZEL_BINARY coverage ${args} ${target}
exit 0