Skip to content

Commit

Permalink
significantly better script
Browse files Browse the repository at this point in the history
  • Loading branch information
dfed committed Oct 12, 2022
1 parent ef97f7b commit 03eef90
Showing 1 changed file with 32 additions and 12 deletions.
44 changes: 32 additions & 12 deletions Scripts/prepare-coverage-reports.sh
@@ -1,25 +1,45 @@
#!/bin/zsh -l
set -e

mkdir -p .build/artifacts

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')
echo "Found executable $cache_advance_tests_executable"
cache_advance_tests_profile=$(find "${directory}" -type f -name 'Coverage.profdata')
echo "Found profile $cache_advance_tests_profile"
exho "Exporting CacheAdvance_$build_type.lcov"
xcrun llvm-cov export -format="lcov" $cache_advance_tests_executable -instr-profile $cache_advance_tests_profile > .build/artifacts/CacheAdvance_$build_type.lcov
exportlcov $build_type $cache_advance_tests_executable $profile

cad_cache_advance_tests_executable=$(find "${directory}" -type f -name 'CADCacheAdvanceTests')
echo "Found executable $cad_cache_advance_tests_executable"
cad_cache_advance_tests_profile=$(find "${directory}" -type f -name 'Coverage.profdata')
echo "Found profile $cad_cache_advance_tests_executable"
exho "Exporting CADCacheAdvance_$build_type.lcov"
xcrun llvm-cov export -format="lcov" $cache_advance_tests_executable -instr-profile $cache_advance_tests_profile > .build/artifacts/CADCacheAdvance_$build_type.lcov
exportlcov $build_type $cad_cache_advance_tests_executable $profile
done

0 comments on commit 03eef90

Please sign in to comment.