Repository navigation
build: Add support for llvm-cov - #19688
Conversation
|
friendly ping @practicalswift @Crypt-iQ @darosior |
I have observed the same issue with |
|
Tested ACK 75f9659
Running |
vasild
left a comment
There was a problem hiding this comment.
ACK 75f9659
Btw, LLVM provides alternative tools to lcov and genhtml. Maybe remove the dependency on those if --enable-lcov is used and the compiler is Clang (then COV_TOOL_WRAPPER would not be needed) and rename that ./configure option to --enable-coverage.
|
Might be a bit unrelated, but I had to move |
maflcko
left a comment
There was a problem hiding this comment.
Concept ACK.
Seems good to merge with two tested ACKs
|
|
||
| baseline.info: | ||
| $(COV_TOOL_WRAPPER): | ||
| @echo 'exec $(COV_TOOL) "$$@"' > $(COV_TOOL_WRAPPER) |
There was a problem hiding this comment.
Could add a comment that this is needed because of a potential dash in the filename of COV_TOOL? (At least I think that was the reason a wrapper is required)
There was a problem hiding this comment.
My understanding is that the wrapper is needed because we run lcov --gcov-tool /path/to/gcov and our gcov is llvm-cov gcov, so lcov --gcov-tool "llvm-cov gcov" other arguments would not work.
It is also possible to generate the coverage without using gcov/lcov:
... compile with clang++ -fprofile-instr-generate -fcoverage-mapping ...
export LLVM_PROFILE_FILE="/tmp/coverage/%m-%p.profraw"
... run unit + functional tests ...
llvm-profdata merge /tmp/coverage/*.profraw -o all.profdata
# Generate lcov-like html report:
llvm-cov export -instr-profile=all.profdata -format=lcov src/test/test_bitcoin -object=src/bitcoind > coverage_lcov.info
genhtml --output-directory /tmp/coverage/html --legend --branch-coverage coverage_lcov.info
# Or generate llvm html report (better templates visualization!):
llvm-cov show -instr-profile=all.profdata -format=html --output-dir=/tmp/coverage/html src/test/test_bitcoin -object=src/bitcoind
I've narrowed this problem down to bitcoin/src/test/util_tests.cpp Line 505 in 6757b3a |
35cd2da test: Fix 'make cov' with clang (Hennadii Stepanov) Pull request description: This is a follow up of #19688. With this PR it is possible to do the following: ``` $ ./autogen.sh $ ./configure --enable-lcov CC=clang CXX=clang++ $ make $ make cov ``` Currently, on master (8a85377), `make cov` fails to `Processing src/test/test_bitcoin-util_tests.gcda`. ACKs for top commit: vasild: ACK 35cd2da Crypt-iQ: ACK 35cd2da Tree-SHA512: aaf56118e2644064e9738a8279889c617db5805c5c804c904469b24c496bd609f9c5fc2aebcf1a422f8a5ed2eb38bd6e76b484680310b55c36d922b73a4c33cf
With this PR it is possible to use
lcovwith clang:NOTE: Unfortunately, on my system (
clang version 10.0.0-4ubuntu1) due to unknown for me reasonsmake covnever finishes, trying toProcessing src/test/test_bitcoin-util_tests.gcdaforever (stopped waiting).Closes #12602