Wojciech Kozlowski
e31b44d31d
Closes #39 Reviewed-on: https://git.wojciechkozlowski.eu/wojtek/musichoard/pulls/50
38 lines
990 B
Markdown
38 lines
990 B
Markdown
# Music Hoard
|
|
|
|
## Code Coverage
|
|
|
|
### Pre-requisites
|
|
|
|
``` sh
|
|
rustup component add llvm-tools-preview
|
|
cargo install grcov
|
|
```
|
|
|
|
### Generating Code Coverage
|
|
|
|
```sh
|
|
env CARGO_TARGET_DIR=codecov \
|
|
cargo clean
|
|
env RUSTFLAGS="-C instrument-coverage" \
|
|
LLVM_PROFILE_FILE="codecov/debug/profraw/musichoard-%p-%m.profraw" \
|
|
CARGO_TARGET_DIR=codecov \
|
|
cargo test --all-features
|
|
grcov codecov/debug/profraw \
|
|
--binary-path ./codecov/debug/ \
|
|
--output-types html \
|
|
--source-dir . \
|
|
--ignore-not-existing \
|
|
--ignore "tests/*" \
|
|
--ignore "src/main.rs" \
|
|
--excl-start "mod tests \{|GRCOV_EXCL_START" \
|
|
--excl-stop "GRCOV_EXCL_STOP" \
|
|
--output-path ./codecov/debug/coverage/
|
|
xdg-open codecov/debug/coverage/index.html
|
|
```
|
|
|
|
Note that some changes may not be visible until `codecov/debug/coverage` is removed and the `grcov`
|
|
command is rerun.
|
|
|
|
For most cases `cargo clean` can be replaced with `rm -rf ./codecov/debug/{coverage,profraw}`.
|