From 9f48af53e06db73fd8c28ef4a280fefa12b1b2d1 Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Wed, 12 Apr 2023 19:45:16 +0200 Subject: [PATCH] Add README about code coverage --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..3b52fe2 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Music Hoard + +## Code Coverage + +### Pre-requisites + +``` sh +rustup component add llvm-tools-preview +cargo install grcov +``` + +### Generating + +```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" \ + --excl-start "#\[cfg\(test\)\]" \ + --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.