codechain icon indicating copy to clipboard operation
codechain copied to clipboard

Needs code coverage evaluation

Open HoOngEe opened this issue 5 years ago • 4 comments

codechain needs code coverage evaluation before releasing version 2.0 Firstly, we need to investigate the coverage measuring tool.

HoOngEe avatar Jul 15 '19 10:07 HoOngEe

kcov does not help and the repository is too old.

HoOngEe avatar Aug 02 '19 06:08 HoOngEe

tarpaulin is much better. Even though the cargo test --all passes successfully, tarpaulin gives error like

test consensus::validator_set::dynamic_validator::tests::validator_set ... Error: "Failed to get test coverage! Error: Failed to run tests: A segfault occurred while executing tests"

HoOngEe avatar Aug 02 '19 06:08 HoOngEe

grcov finally works with

RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads" cargo +nightly test --all;
zip -0 ccov.zip `find . \( -name "codechain*.gc*" \) -print`;
grcov ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore-dir "/*" -o lcov.info;

It reported 스크린샷, 2019-08-02 18-54-47

HoOngEe avatar Aug 02 '19 09:08 HoOngEe

But still It counts test functions' lines, I need to study more about ignore test functions from counting.

HoOngEe avatar Aug 02 '19 09:08 HoOngEe