I found couple of tools that generate code coverage report (like grcov
, tarpaulin
, llvm-cov
& kcov
) for Rust code when running unit tests or when triggered by cargo
.
But in our case we have remote python tests that are interacting with the remote server written in Rust. How can I instrument and collect such coverage report?
Have a similar solution which we tackled using LLVM source based code coverage: Source Based Code Coverage. You will require LLVM installation.
Here are the steps:
Add the env variable to locate the collected coverage file.
export LLVM_PROFILE_FILE="/tmp/server_%p%c.profraw"
After the tests, end the server process and collect the the generated profraw files in a
cov_dir
and the server binary inbin_dir
. Use grcov (cargo install grcov) to generate an html report: