forked from google/reftable
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoverage.sh
More file actions
30 lines (22 loc) · 790 Bytes
/
coverage.sh
File metadata and controls
30 lines (22 loc) · 790 Bytes
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
#!/bin/sh
set -eu
tests=$(ls -1 c/*_test.c | sed 's|\.c$||' )
nontest=$(ls -1 c/*.c | grep -v test)
export BAZEL_USE_LLVM_NATIVE_COVERAGE=1
export GCOV=llvm-profdata
eval "$(grep LLVM_CONFIG clang.bazelrc | head -1 | sed 's|.*\(LLVM_CONFIG=\)|\1|')"
PATH=$(${LLVM_CONFIG} --bindir):${PATH}
bazel --bazelrc clang.bazelrc coverage --config=clang \
${tests}
OBJECTS=""
for t in ${tests}; do
OBJECTS="${OBJECTS} bazel-bin/$t"
done
mkdir -p coverage
llvm-profdata merge -sparse \
-o coverage/coverage.dat \
$(find -L $(bazel info bazel-testlogs) -name coverage.dat )
llvm-cov show -instr-profile=coverage/coverage.dat \
bazel-bin/c/libreftable.so -Xdemangler=c++filt \
-output-dir=coverage/ -format=html
sed -i -e 's|>proc/self/cwd/|>|g' "coverage/index.html"