-
Notifications
You must be signed in to change notification settings - Fork 37.8k
build: Add support for llvm-cov #19688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
friendly ping @practicalswift @Crypt-iQ @darosior |
I have observed the same issue with |
Tested ACK 75f9659
Running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK.
Seems good to merge with two tested ACKs
@@ -192,7 +192,11 @@ LCOV_FILTER_PATTERN = \ | |||
-p "src/secp256k1" \ | |||
-p "depends" | |||
|
|||
baseline.info: | |||
$(COV_TOOL_WRAPPER): | |||
@echo 'exec $(COV_TOOL) "$$@"' > $(COV_TOOL_WRAPPER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
75f9659 build: Add missed fuzz.coverage/ directory to .gitignore (Hennadii Stepanov) 8ebc050 build: Add missed fuzz_filtered.info to COVERAGE_INFO (Hennadii Stepanov) c71bdf9 build, test: Add support for llvm-cov (Hennadii Stepanov) Pull request description: With this PR it is possible to use `lcov` with clang: ``` $ ./autogen.sh $ ./configure --enable-lcov --enable-fuzz --with-sanitizers=fuzzer CC=clang CXX=clang++ $ make $ make cov_fuzz ``` --- NOTE: Unfortunately, on my system (`clang version 10.0.0-4ubuntu1`) due to unknown for me reasons `make cov` never finishes, trying to `Processing src/test/test_bitcoin-util_tests.gcda` forever (stopped waiting). Closes bitcoin#12602 ACKs for top commit: Crypt-iQ: Tested ACK 75f9659 vasild: ACK 75f9659 Tree-SHA512: 4bc31b38fa62d70c21f890f17f0340e64d0509cea3c29ff6ac101e90ae65d2032640abf100a380c31557bea4c3f54301c2acc2b88a00cbc5261d54c01358ce4e
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
lcov
with clang:NOTE: Unfortunately, on my system (
clang version 10.0.0-4ubuntu1
) due to unknown for me reasonsmake cov
never finishes, trying toProcessing src/test/test_bitcoin-util_tests.gcda
forever (stopped waiting).Closes #12602