Files
pgcat/.circleci/generate_coverage.sh
Mostafa Abdelraouf 28f2d19cac More coverage cleanup (#328)
Apply a new style + remove function coverage report
2023-02-17 09:18:54 -06:00

16 lines
764 B
Bash
Executable File

#!/bin/bash
# inspired by https://doc.rust-lang.org/rustc/instrument-coverage.html#tips-for-listing-the-binaries-automatically
TEST_OBJECTS=$( \
for file in $(cargo test --no-run 2>&1 | grep "target/debug/deps/pgcat-[[:alnum:]]\+" -o); \
do \
printf "%s %s " --object $file; \
done \
)
rust-profdata merge -sparse /tmp/pgcat-*.profraw -o /tmp/pgcat.profdata
bash -c "rust-cov export -ignore-filename-regex='rustc|registry' -Xdemangler=rustfilt -instr-profile=/tmp/pgcat.profdata $TEST_OBJECTS --object ./target/debug/pgcat --format lcov > ./lcov.info"
genhtml lcov.info --title "PgCat Code Coverage" --css-file ./cov-style.css --no-function-coverage --highlight --ignore-errors source --legend --output-directory /tmp/cov --prefix $(pwd)