2023-04-12 19:55:57 +02:00
|
|
|
# Music Hoard
|
|
|
|
|
|
|
|
## Code Coverage
|
|
|
|
|
|
|
|
### Pre-requisites
|
|
|
|
|
|
|
|
``` sh
|
|
|
|
rustup component add llvm-tools-preview
|
|
|
|
cargo install grcov
|
|
|
|
```
|
|
|
|
|
|
|
|
### Generating Code Coverage
|
|
|
|
|
|
|
|
```sh
|
|
|
|
cargo clean
|
|
|
|
env RUSTFLAGS="-C instrument-coverage" \
|
|
|
|
LLVM_PROFILE_FILE="target/debug/profraw/musichoard-%p-%m.profraw" \
|
|
|
|
cargo test
|
|
|
|
grcov target/debug/profraw \
|
|
|
|
--binary-path ./target/debug/ \
|
|
|
|
--output-types html \
|
|
|
|
--source-dir . \
|
|
|
|
--ignore-not-existing \
|
|
|
|
--ignore "tests/*" \
|
|
|
|
--ignore "src/main.rs" \
|
2023-04-12 20:55:41 +02:00
|
|
|
--excl-start "mod tests \{" \
|
2023-04-12 19:55:57 +02:00
|
|
|
--output-path ./target/debug/coverage/
|
|
|
|
xdg-open target/debug/coverage/index.html
|
|
|
|
```
|
|
|
|
|
|
|
|
Note that some changes may not be visible until `target/debug/coverage` is removed and the `grcov`
|
|
|
|
command is rerun.
|