Scripts for test coverage in Rust.
(Tested only on Ubuntu 18.04 & 20.04)
run-all-tests.sh
- call all of your tests here
There are 3½ variants of toolsets to pick from:
coverage-grcov.sh
*.profraw ---> [grcov] +--------------> HTML | +--> [lcov] ---> HTML
coverage-llvm.sh
*.profraw ---> [llvm-profdata] ---> [llvm-cov] ---> [lcov] ---> HTML
coverage-gcov.sh
*.gcda/*.gcno ---> [gcov] ---> [lcov] ---> HTML
All:
rustup install nightly
Toolset specific:
-
coverage-grcov.sh
If needed:
update-alternatives-clang.sh
to force the defaultllvm
versionrustup component add llvm-tools-preview --toolchain nightly
cargo install grcov
Optionally:
apt-get install lcov
When in doubt: more about grcov
-
coverage-llvm.sh
If needed:
update-alternatives-clang.sh
to force the defaultllvm
versioncargo install rustfilt
apt-get install lcov
When in doubt: this chapter of Rust unstable .
-
coverage-gcov.sh
apt-get install gcc-7 lcov