diff --git a/Cargo.toml b/Cargo.toml index 2f7f3618622..77637f907c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,3 +32,16 @@ members = [ ] exclude = ["implementations/rust/ockam/ockam_examples/example_projects"] + +# Coverage profile for generating code coverage with grcov. +# +# See https://github.com/rust-lang/rust/issues/78011. +# +[profile.coverage] +panic = "abort" +opt-level = 0 +overflow-checks = false +incremental = false +codegen-units = 1 +inherits = "test" + diff --git a/implementations/rust/DEVELOP.md b/implementations/rust/DEVELOP.md index ae233ee3969..4087158e436 100644 --- a/implementations/rust/DEVELOP.md +++ b/implementations/rust/DEVELOP.md @@ -83,7 +83,7 @@ Get a code coverage report: ``` cargo +nightly install grcov -env CARGO_INCREMENTAL=0 RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort --cfg tokio_unstable" RUSTDOCFLAGS="-Cpanic=abort" cargo +nightly test +env CARGO_INCREMENTAL=0 RUSTFLAGS="-Zprofile -Clink-dead-code --cfg tokio_unstable" cargo +nightly test --profile coverage grcov --llvm . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage/