Changeset View
Changeset View
Standalone View
Standalone View
doc/developer-notes.md
Show First 20 Lines • Show All 277 Lines • ▼ Show 20 Lines | |||||
$ valgrind --suppressions=contrib/valgrind.supp src/test/test_bitcoin | $ valgrind --suppressions=contrib/valgrind.supp src/test/test_bitcoin | ||||
$ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \ | $ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \ | ||||
--show-leak-kinds=all src/test/test_bitcoin --log_level=test_suite | --show-leak-kinds=all src/test/test_bitcoin --log_level=test_suite | ||||
$ valgrind -v --leak-check=full src/bitcoind -printtoconsole | $ valgrind -v --leak-check=full src/bitcoind -printtoconsole | ||||
``` | ``` | ||||
### Compiling for test coverage | ### 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 some test targets | ||||
execution. LCOV must be installed on your system (e.g. the `lcov` package | execution. Some packages are required to generate the coverage report: | ||||
on Debian/Ubuntu). | `c++filt`, `gcov`, `genhtml`, `lcov` and `python3`. | ||||
To enable LCOV report generation during test runs: | To install these dependencies on Debian 10: | ||||
```shell | ```shell | ||||
./configure --enable-lcov | sudo apt install binutils-common g++ lcov python3 | ||||
make | ``` | ||||
make cov | |||||
To enable LCOV report generation during test runs: | |||||
# A coverage report will now be accessible at `./test_bitcoin.coverage/index.html`. | ```shell | ||||
cmake -GNinja .. -DCMAKE_BUILD_TYPE=Coverage -DCCACHE=OFF | |||||
ninja coverage-check-all | |||||
``` | ``` | ||||
A coverage report will now be accessible at `./check_all.coverage/index.html`. | |||||
To include branch coverage, you can add the `-DENABLE_BRANCH_COVERAGE=ON` option | |||||
to the `cmake` command line. | |||||
### Sanitizers | ### Sanitizers | ||||
Bitcoin ABC can be compiled with various "sanitizers" enabled, which add | Bitcoin ABC can be compiled with various "sanitizers" enabled, which add | ||||
instrumentation for issues regarding things like memory safety, thread race | instrumentation for issues regarding things like memory safety, thread race | ||||
conditions, or undefined behavior. This is controlled with the | conditions, or undefined behavior. This is controlled with the | ||||
`--with-sanitizers` configure flag, which should be a comma separated list of | `--with-sanitizers` configure flag, which should be a comma separated list of | ||||
sanitizers to enable. The sanitizer list should correspond to supported | sanitizers to enable. The sanitizer list should correspond to supported | ||||
`-fsanitize=` options in your compiler. These sanitizers have runtime overhead, | `-fsanitize=` options in your compiler. These sanitizers have runtime overhead, | ||||
▲ Show 20 Lines • Show All 628 Lines • Show Last 20 Lines |