This repository is created for implementating instrumentation-based modified condition/decision coverage in rust compiler based on llvm.
It is still under development and waiting for more tests. All changes are committed to the master branch.
Roadmap
See the track issure
Quick start
To run tests
git clone https://github.com/ZhuUx/rust.git
git checkout master
./x build --stage 1
./x test tests/coverage/mcdc_if.rsTo check code of foo
export PATH=path/to/llvm-build:$PATH rustup toolchain link mcdc build/host/stage1 cargo +mcdc rustc --bin foo -- -Cinstrument-coverage -Zcoverage-options=mcdc cd target/debug LLVM_PROFILE_FILE="foo.profraw" ./foo llvm-profdata merge -sparse foo.profraw -o foo.profdata llvm-cov show ./foo -instr-profile=foo.profdata --show-mcdc
Note that if a custom llvm is used, the llvm version should be 18 or later.
Acknowledgment & Credits
This repository only contains works by Banma. But mcdc implementation for rust also is co-authored by RenjiSann from Adacore, Zalathar.
evodius96 lands mcdc implementation on llvm and clarifies the details.
implements branch coverage, which introduces essential base for mcdc, and reviews a lot.
Ferrous shares their research about mcdc in rust.