mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 10:19:26 +02:00
cmake: Add Coverage
and CoverageFuzz
scripts
This commit is contained in:
@ -476,25 +476,34 @@ $ ./test/functional/test_runner.py --valgrind
|
||||
|
||||
### Compiling for test coverage
|
||||
|
||||
LCOV can be used to generate a test coverage report based upon `make check`
|
||||
LCOV can be used to generate a test coverage report based upon `ctest`
|
||||
execution. LCOV must be installed on your system (e.g. the `lcov` package
|
||||
on Debian/Ubuntu).
|
||||
|
||||
To enable LCOV report generation during test runs:
|
||||
|
||||
```shell
|
||||
./configure --enable-lcov
|
||||
make
|
||||
make cov
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=Coverage
|
||||
cmake --build build
|
||||
cmake -P build/Coverage.cmake
|
||||
|
||||
# A coverage report will now be accessible at `./test_bitcoin.coverage/index.html`,
|
||||
# which covers unit tests, and `./total.coverage/index.html`, which covers
|
||||
# A coverage report will now be accessible at `./build/test_bitcoin.coverage/index.html`,
|
||||
# which covers unit tests, and `./build/total.coverage/index.html`, which covers
|
||||
# unit and functional tests.
|
||||
```
|
||||
|
||||
Additional LCOV options can be specified using `LCOV_OPTS`, but may be dependent
|
||||
on the version of LCOV. For example, when using LCOV `2.x`, branch coverage can be
|
||||
enabled by setting `LCOV_OPTS="--rc branch_coverage=1"`, when configuring.
|
||||
enabled by setting `LCOV_OPTS="--rc branch_coverage=1"`:
|
||||
|
||||
```
|
||||
cmake -DLCOV_OPTS="--rc branch_coverage=1" -P build/Coverage.cmake
|
||||
```
|
||||
|
||||
To enable test parallelism:
|
||||
```
|
||||
cmake -DJOBS=$(nproc) -P build/Coverage.cmake
|
||||
```
|
||||
|
||||
### Performance profiling with perf
|
||||
|
||||
|
Reference in New Issue
Block a user