-
Notifications
You must be signed in to change notification settings - Fork 3
/
prepare-coverage-reports.sh
executable file
·45 lines (35 loc) · 1.32 KB
/
prepare-coverage-reports.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
37
38
39
40
41
42
43
44
45
#!/bin/zsh -l
set -e
root=$(git rev-parse --show-toplevel)
function exportlcov() {
build_type=$1
executable=$2
profile=$3
can_proceed=true
if ! test -f $executable; then
echo "\tCould not find executable for $build_type"
can_proceed=false
fi
if ! test -f $profile; then
echo "\tCould not find profile for $build_type"
can_proceed=false
fi
if $can_proceed; then
output_dir=".build/artifacts/$build_type"
mkdir -p $output_dir
output_file="$output_dir/$(basename $executable).lcov"
echo "\tExporting $output_file"
xcrun llvm-cov export -format="lcov" $executable -instr-profile $profile > $output_file
else
echo "\tAborting creation of lcov file for $build_type"
fi
}
for directory in $root/.build/derivedData/*/; do
build_type=$(basename $directory)
echo "Finding coverage information for $build_type"
profile=$(find "${directory}" -type f -name 'Coverage.profdata')
cache_advance_tests_executable=$(find "${directory}" -type f -name 'CacheAdvanceTests')
exportlcov $build_type $cache_advance_tests_executable $profile
cad_cache_advance_tests_executable=$(find "${directory}" -type f -name 'CADCacheAdvanceTests')
exportlcov $build_type $cad_cache_advance_tests_executable $profile
done