mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-23 01:16:30 +00:00
Code coverage logic was missing coverage from rust tests. This is now fixed. Also, we weren't reaping spawned PgCat processes correctly which left zombie processes.
16 lines
623 B
Bash
Executable File
16 lines
623 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 pgcat-*.profraw -o pgcat.profdata
|
|
|
|
bash -c "rust-cov export -ignore-filename-regex='rustc|registry' -Xdemangler=rustfilt -instr-profile=pgcat.profdata $TEST_OBJECTS --object ./target/debug/pgcat --format lcov > ./lcov.info"
|
|
|
|
genhtml lcov.info --output-directory /tmp/cov --prefix $(pwd)
|