musichoard/README.md

38 lines
975 B
Markdown
Raw Normal View History

# Music Hoard
## Code Coverage
### Pre-requisites
``` sh
rustup component add llvm-tools-preview
cargo install grcov
```
### Generating Code Coverage
```sh
2023-04-10 22:19:29 +02:00
env CARGO_TARGET_DIR=codecov \
cargo clean
env RUSTFLAGS="-C instrument-coverage" \
2023-04-10 22:19:29 +02:00
LLVM_PROFILE_FILE="codecov/debug/profraw/musichoard-%p-%m.profraw" \
CARGO_TARGET_DIR=codecov \
cargo test
2023-04-10 22:19:29 +02:00
grcov codecov/debug/profraw \
--binary-path ./codecov/debug/ \
--output-types html \
--source-dir . \
--ignore-not-existing \
--ignore "tests/*" \
--ignore "src/main.rs" \
2023-04-10 22:19:29 +02:00
--excl-start "mod tests \{|GRCOV_EXCL_START" \
--excl-stop "GRCOV_EXCL_STOP" \
--output-path ./codecov/debug/coverage/
xdg-open codecov/debug/coverage/index.html
```
2023-04-10 22:19:29 +02:00
Note that some changes may not be visible until `codecov/debug/coverage` is removed and the `grcov`
command is rerun.
2023-04-10 22:19:29 +02:00
For most cases `cargo clean` can be replaced with `rm -rf ./codecov/debug/{coverage,profraw}`.