Remove bench-tps, upload-perf, and bench-streamer from code coverage report

This commit is contained in:
Michael Vines 2019-03-05 15:04:16 -08:00 committed by Grimes
parent cb0560df92
commit c24d95c885
1 changed files with 11 additions and 9 deletions

View File

@ -35,29 +35,31 @@ _ scripts/fetch-grcov.sh
echo "--- grcov"
./grcov target/cov/debug/deps/ > target/cov/lcov-full.info
echo "--- filter-non-local-files-from-lcov"
# TODO: The grcov `-s` option could be used to replace this function once grcov
# doesn't panic on files with the same name in different directories of a
# repository
filter-non-local-files-from-lcov() {
echo "--- filter-files-from-lcov"
# List of directories to remove from the coverage report
ignored_directories="^(bench-tps|upload-perf|bench-streamer)"
filter-files-from-lcov() {
declare skip=false
while read -r line; do
if [[ $line =~ ^SF:/ ]]; then
skip=true # Skip all absolute paths as these are references into ~/.cargo
elif [[ $line =~ ^SF:(.*) ]]; then
# Skip relative paths that don't exist
declare file="${BASH_REMATCH[1]}"
if [[ -r $file ]]; then
if [[ $file =~ $ignored_directories ]]; then
skip=true # Skip paths into ignored locations
elif [[ -r $file ]]; then
skip=false
else
skip=true
skip=true # Skip relative paths that don't exist
fi
fi
[[ $skip = true ]] || echo "$line"
done
}
filter-non-local-files-from-lcov < target/cov/lcov-full.info > target/cov/lcov.info
filter-files-from-lcov < target/cov/lcov-full.info > target/cov/lcov.info
echo "--- html report"
# ProTip: genhtml comes from |brew install lcov| or |apt-get install lcov|