Is there an existing issue for this?
- I have searched the existing issues
Current behaviour
I'm trying to compile Bitcoin Core for test coverage as explained in doc/developer-notes.md, but the command cmake -P build/Coverage.cmake fails with
[...]
Finished .info-file creation
Deleting all .da files in src and subdirectories
Done.
.lcov-wrapped: WARNING: negative counts found in tracefile test_bitcoin_filtered.info
Combining tracefiles.
Reading tracefile test_bitcoin_filtered.info
Writing data to test_bitcoin_filtered.info
Summary coverage rate:
lines......: 70.5% (76896 of 109080 lines)
functions..: 64.7% (21913 of 33862 functions)
branches...: no data found
Combining tracefiles.
Reading tracefile baseline_filtered.info
Reading tracefile test_bitcoin_filtered.info
Writing data to test_bitcoin_coverage.info
Summary coverage rate:
lines......: 69.6% (76896 of 110489 lines)
functions..: 64.0% (21913 of 34217 functions)
branches...: no data found
Reading data file test_bitcoin_coverage.info
Found 1038 entries.
Found common filename prefix "/home/daniela/Developer/bitcoin"
Writing .css and .png files.
Generating output.
genhtml: ERROR: cannot read /home/daniela/Developer/bitcoin/build/src/include/boost/operators.hpp
Processing file build/src/include/boost/operators.hpp
CMake Error at build/Coverage.cmake:46 (execute_process):
execute_process failed command indexes:
1: "Child return code: 2"
The command output is also full of similar warnings:
geninfo: WARNING: could not open /home/daniela/Developer/bitcoin/build/src/include/boost/smart_ptr/detail/shared_count.hpp
The files ./build/test_bitcoin.coverage/index.html and ./build/total.coverage/index.html are not created
Expected behaviour
Compilation succeeds and I'm able to see the ./build/test_bitcoin.coverage/index.html and ./build/total.coverage/index.html files
Steps to reproduce
cmake -B build -DCMAKE_BUILD_TYPE=Coverage
cmake --build build
cmake -P build/Coverage.cmake
Relevant log output
<details> <summary> Configure build </summary>
$ cmake -B build -DCMAKE_BUILD_TYPE=Coverage
Configuring secp256k1 subtree...
-- Could NOT find Valgrind (missing: Valgrind_INCLUDE_DIR Valgrind_WORKS)
secp256k1 configure summary
===========================
Build artifacts:
library type ........................ Static
Optional modules:
ECDH ................................ OFF
ECDSA pubkey recovery ............... ON
extrakeys ........................... ON
schnorrsig .......................... ON
ElligatorSwift ...................... ON
Parameters:
ecmult window size .................. 15
ecmult gen table size ............... 86 KiB
Optional features:
assembly ............................ x86_64
external callbacks .................. OFF
Optional binaries:
benchmark ........................... OFF
noverify_tests ...................... ON
tests ............................... OFF
exhaustive tests .................... ON
ctime_tests ......................... OFF
examples ............................ OFF
Cross compiling ....................... FALSE
Valgrind .............................. OFF
Preprocessor defined macros ........... ENABLE_MODULE_ELLSWIFT=1 ENABLE_MODULE_SCHNORRSIG=1 ENABLE_MODULE_EXTRAKEYS=1 ENABLE_MODULE_RECOVERY=1 ECMULT_WINDOW_SIZE=15 COMB_BLOCKS=43 COMB_TEETH=6 USE_ASM_X86_64=1
C compiler ............................ GNU 13.2.0, /nix/store/r73z9i18vbjcph7k2f3isrysxzx6sqjx-gcc-wrapper-13.2.0/bin/gcc
CFLAGS ................................
Compile options ....................... -pedantic -Wall -Wcast-align -Wcast-align=strict -Wextra -Wnested-externs -Wno-long-long -Wno-overlength-strings -Wno-unused-function -Wshadow -Wstrict-prototypes -Wundef
Build type:
- CMAKE_BUILD_TYPE ................... Coverage
- CFLAGS ............................. -O2 -g -O0 -DCOVERAGE=1 --coverage
- LDFLAGS for executables ............ --coverage
- LDFLAGS for shared libraries ....... --coverage
Configure summary
=================
Executables:
bitcoind ............................ ON
bitcoin-node (multiprocess) ......... OFF
bitcoin-qt (GUI) .................... OFF
bitcoin-gui (GUI, multiprocess) ..... OFF
bitcoin-cli ......................... ON
bitcoin-tx .......................... ON
bitcoin-util ........................ ON
bitcoin-wallet ...................... ON
bitcoin-chainstate (experimental) ... OFF
libbitcoinkernel (experimental) ..... OFF
Optional features:
wallet support ...................... ON
- descriptor wallets (SQLite) ...... ON
- legacy wallets (Berkeley DB) ..... OFF
external signer ..................... ON
port mapping using UPnP ............. OFF
ZeroMQ .............................. OFF
USDT tracing ........................ OFF
QR code (GUI) ....................... OFF
DBus (GUI, Linux only) .............. OFF
Tests:
test_bitcoin ........................ ON
test_bitcoin-qt ..................... OFF
bench_bitcoin ....................... OFF
fuzz binary ......................... OFF
Cross compiling ....................... FALSE
C++ compiler .......................... GNU 13.2.0, /nix/store/r73z9i18vbjcph7k2f3isrysxzx6sqjx-gcc-wrapper-13.2.0/bin/g++
CMAKE_BUILD_TYPE ...................... Coverage
Preprocessor defined macros ...........
C++ compiler flags .................... -g -Og --coverage -std=c++20 -fPIC -fdebug-prefix-map=/home/daniela/Developer/bitcoin=. -fmacro-prefix-map=/home/daniela/Developer/bitcoin=. -fno-extended-identifiers -fstack-reuse=none -Wall -Wextra -Wformat -Wformat-security -Wvla -Wredundant-decls -Wdate-time -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Woverloaded-virtual -Wsuggest-override -Wimplicit-fallthrough -Wunreachable-code -Wundef -Wno-unused-parameter -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -Wstack-protector -fstack-protector-all -fcf-protection=full -fstack-clash-protection
Linker flags .......................... -g -Og --coverage -fstack-reuse=none -fstack-protector-all -fcf-protection=full -fstack-clash-protection -Wl,-z,relro -Wl,-z,now -Wl,-z,separate-code -fPIE -pie
NOTE: The summary above may not exactly match the final applied build flags
if any additional CMAKE_* or environment variables have been modified.
To see the exact flags applied, build with the --verbose option.
Attempt to harden executables ......... ON
Treat compiler warnings as errors ..... OFF
Use ccache for compiling .............. ON
-- Configuring done (0.3s)
-- Generating done (0.1s)
-- Build files have been written to: /home/daniela/Developer/bitcoin/build
</details>
<details> <summary> Generate code coverage report (trimmed) </summary>
Capturing coverage data from src
Found gcov version: 13.2.0
Using intermediate gcov format
Using JSON module JSON::PP
Scanning src for .gcno files ...
Found 398 graph files in src
Processing univalue/CMakeFiles/object.dir/test/object.cpp.gcno
Processing univalue/CMakeFiles/unitester.dir/test/unitester.cpp.gcno
Processing univalue/CMakeFiles/univalue.dir/lib/univalue_read.cpp.gcno
Processing univalue/CMakeFiles/univalue.dir/lib/univalue_write.cpp.gcno
Processing univalue/CMakeFiles/univalue.dir/lib/univalue_get.cpp.gcno
Processing univalue/CMakeFiles/univalue.dir/lib/univalue.cpp.gcno
Processing util/CMakeFiles/bitcoin_util.dir/exception.cpp.gcno
Processing util/CMakeFiles/bitcoin_util.dir/__/random.cpp.gcno
Processing util/CMakeFiles/bitcoin_util.dir/__/streams.cpp.gcno
Processing util/CMakeFiles/bitcoin_util.dir/__/support/lockedpool.cpp.gcno
Processing util/CMakeFiles/bitcoin_util.dir/__/randomenv.cpp.gcno
Processing util/CMakeFiles/bitcoin_util.dir/__/sync.cpp.gcno
/home/daniela/Developer/bitcoin/build/src/util/CMakeFiles/bitcoin_util.dir/__/sync.cpp.gcno:no functions found
geninfo: WARNING: GCOV did not produce any data for /home/daniela/Developer/bitcoin/build/src/util/CMakeFiles/bitcoin_util.dir/__/sync.cpp.gcno
[...]
Processing CMakeFiles/bitcoin_node.dir/txmempool.cpp.gcno
geninfo: WARNING: could not open /home/daniela/Developer/bitcoin/build/src/include/boost/multi_index/detail/bidir_node_iterator.hpp
geninfo: WARNING: could not open /home/daniela/Developer/bitcoin/build/src/include/boost/multi_index/detail/hash_index_iterator.hpp
geninfo: WARNING: could not open /home/daniela/Developer/bitcoin/build/src/include/boost/utility/base_from_member.hpp
geninfo: WARNING: could not open /home/daniela/Developer/bitcoin/build/src/include/boost/operators.hpp
geninfo: WARNING: could not open /home/daniela/Developer/bitcoin/build/src/include/boost/tuple/detail/tuple_basic.hpp
geninfo: WARNING: could not open /home/daniela/Developer/bitcoin/build/src/include/boost/multi_index/detail/bucket_array.hpp
geninfo: WARNING: could not open /home/daniela/Developer/bitcoin/build/src/include/boost/multi_index/hashed_index.hpp
geninfo: WARNING: could not open /home/daniela/Developer/bitcoin/build/src/include/boost/multi_index/detail/hash_index_node.hpp
geninfo: WARNING: could not open /home/daniela/Developer/bitcoin/build/src/include/boost/multi_index/detail/auto_space.hpp
geninfo: WARNING: could not open /home/daniela/Developer/bitcoin/build/src/include/boost/multi_index/detail/index_base.hpp
geninfo: WARNING: could not open /home/daniela/Developer/bitcoin/build/src/include/boost/multi_index/detail/ord_index_node.hpp
geninfo: WARNING: could not open /home/daniela/Developer/bitcoin/build/src/include/boost/multi_index/detail/ord_index_impl.hpp
geninfo: WARNING: could not open /home/daniela/Developer/bitcoin/build/src/include/boost/multi_index/detail/index_node_base.hpp
geninfo: WARNING: could not open /home/daniela/Developer/bitcoin/build/src/include/boost/multi_index/detail/header_holder.hpp
geninfo: WARNING: could not open /home/daniela/Developer/bitcoin/build/src/include/boost/multi_index_container.hpp
geninfo: WARNING: some exclusion markers may be ignored
Processing CMakeFiles/bitcoin_node.dir/netgroup.cpp.gcno
[...]
Finished .info-file creation
Deleting all .da files in src and subdirectories
Done.
.lcov-wrapped: WARNING: negative counts found in tracefile test_bitcoin_filtered.info
Combining tracefiles.
Reading tracefile test_bitcoin_filtered.info
Writing data to test_bitcoin_filtered.info
Summary coverage rate:
lines......: 70.5% (76896 of 109080 lines)
functions..: 64.7% (21913 of 33862 functions)
branches...: no data found
Combining tracefiles.
Reading tracefile baseline_filtered.info
Reading tracefile test_bitcoin_filtered.info
Writing data to test_bitcoin_coverage.info
Summary coverage rate:
lines......: 69.6% (76896 of 110489 lines)
functions..: 64.0% (21913 of 34217 functions)
branches...: no data found
Reading data file test_bitcoin_coverage.info
Found 1038 entries.
Found common filename prefix "/home/daniela/Developer/bitcoin"
Writing .css and .png files.
Generating output.
genhtml: ERROR: cannot read /home/daniela/Developer/bitcoin/build/src/include/boost/operators.hpp
Processing file build/src/include/boost/operators.hpp
CMake Error at build/Coverage.cmake:46 (execute_process):
execute_process failed command indexes:
1: "Child return code: 2"
</details>
For full output: coverage.txt (sorry, github doesn't let me paste the full output as it's too long)
How did you obtain Bitcoin Core
Compiled from source
What version of Bitcoin Core are you using?
master@48cf3da636089873ba7280e0d5b22eb81811d194
Operating system and version
NixOS 24.05
Machine specifications
No response