From b8d8b682708fd9e1fedafcb99839293f476b522d Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sun, 19 Dec 2021 17:10:24 +0100 Subject: [PATCH] DOC: add instructions for code coverage measurements --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 71f41fb..c9ee712 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,20 @@ Creating the HTML docs (which will be available in `target/doc/rtrb/index.html`) cargo doc +To measure code coverage, nightly Rust is required, as well as a few additional dependencies: + + rustup toolchain install nightly + rustup component add llvm-tools-preview + cargo install grcov + +Test coverage data can be obtained and analyzed with these commands: + + cargo clean + RUSTFLAGS="-Z instrument-coverage" RUSTDOCFLAGS="-Z instrument-coverage -Z unstable-options --persist-doctests target/debug/doctestbins" LLVM_PROFILE_FILE="coverage/%p-%m.profraw" cargo +nightly test + grcov coverage --source-dir . --binary-path target/debug --output-type html --output-path coverage + +The last command creates an HTML report in `coverage/index.html`. + Minimum Supported `rustc` Version ---------------------------------