Trust Developer
Search…
Coverage
Wallet-core is a stable project, we value stability and safety over new features.
Test coverage is one important facet of assuring code quality, and we are strict about high test coverage.

Checking Coverage Summary in CI build

The Linux CI CI build (executed on PRs and commits) contains coverage measurement, and summary is available in the build output:
1
Summary coverage rate:
2
lines......: 94.5% (14576 of 15426 lines)
3
functions..: 95.0% (2688 of 2830 functions)
Copied!

Detailed Coverage Report

Detailed coverage report can be generated locally. It includes file and line-level info on coverage.
Steps:
    Run tools/generate-file to make sure new added files are generated
    Run cmake, to enable coverage measurement
1
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug -DCODE_COVERAGE=ON
Copied!
    Build tests
1
make -Cbuild -j12 tests TrezorCryptoTests
Copied!
    Cleanup any old coverage files, and run unit tests
1
find . -name "*.gcda" -exec rm {} \;
2
./build/trezor-crypto/crypto/tests/TrezorCryptoTests
3
./build/tests/tests tests --gtest_output=xml
Copied!
    Generate coverage info (slow). With the html argument the script will generate HTML report as well:
1
./tools/coverage html
Copied!
if you see genhtml (from lcov) error on macOS like below:
1
c++filt: Unknown command line argument '--no-strip-underscores'. Try: '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++filt --help'
2
c++filt: Did you mean '--no-strip-underscore'?
3
genhtml: ERROR: c++filt output not as expected (0 vs 11) lines
Copied!
please patch genhtml (for example /usr/local/Cellar/lcov/1.15/libexec/bin/), change --no-strip-underscores to --no-strip-underscore
Open the generated coverage/index.html to view the report.
Last modified 5mo ago