forked from northpolesec/santa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_cov.sh
executable file
·29 lines (24 loc) · 986 Bytes
/
generate_cov.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
#!/bin/sh
GIT_ROOT=$(git rev-parse --show-toplevel)
BAZEL_EXEC_ROOT=$(bazel info execution_root)
COV_FILE="$(bazel info output_path)/_coverage/_coverage_report.dat"
function main() {
bazel coverage \
--experimental_use_llvm_covmap \
--instrument_test_targets \
--combined_report=lcov \
--spawn_strategy=standalone \
--test_env=LCOV_MERGER=/usr/bin/true \
--test_output=all \
//:unit_tests
# The generated file has most of the source files relative to bazel's
# execution_root path, so we strip that off as it prevents files being
# picked up by Coveralls.
sed -i '' "s,${BAZEL_EXEC_ROOT},${GIT_ROOT}," ${COV_FILE}
# We also want to filter out files that aren't ours but which sometimes get
# coverage data created anyway.
sed -i '' '/SF:\/Applications.*/,/end_of_record/d' ${COV_FILE}
sed -i '' '/SF:.*santa\/bazel-out.*/,/end_of_record/d' ${COV_FILE}
find bazel-out/ -name "*.dat" -type f | tar -czf "raw_coverages.tgz" -T -
}
main