This supports lcov 2.x
in the sense that we are no-longer hardcoding version specific options, and instead will use the LCOV_OPTS
variable (which is the more flexible thing to do in any case). It’s also quite likely that devs are already having to pass extra options to lcov 2.x
, given it’s more stringent in terms of coverage generation and error checking. See this thread for an example: https://github.com/linux-test-project/lcov/issues/238.
Tested on one machine (LCOV 2.0, gcc 13.2) with:
0./autogen.sh
1./configure --enable-lcov CXXFLAGS="-fprofile-update=prefer-atomic" LCOV_OPTS="--rc branch_coverage=1 --ignore-errors mismatch"
2make
3make cov
4<snip>
5Processing file src/netaddress.cpp
6 lines=521 hit=480 functions=72 hit=72 branches=675 hit=499
7Overall coverage rate:
8 lines......: 81.8% (79362 of 97002 lines)
9 functions......: 77.8% (10356 of 13310 functions)
10 branches......: 49.6% (130628 of 263196 branches)
and another machine (LCOV 2.1, Clang 18.1.3) with:
0./autogen.sh
1./configure --enable-lcov CC=clang CXX=clang++ LCOV_OPTS="--rc branch_coverage=1 --ignore-errors mismatch,inconsistent"
2make
3make cov
4<snip>
5 Processing file src/util/strencodings.cpp
6 lines=315 hit=311 functions=38 hit=38 branches=425 hit=357
7 Overall coverage rate:
8 source files: 622
9 lines.......: 79.8% (70311 of 88132 lines)
10 functions...: 78.1% (13968 of 17881 functions)
11 branches....: 44.5% (157551 of 354317 branches)
12 Message summary:
13 101 warning messages:
14 count: 1
15 inconsistent: 100
16 3528 ignore messages:
17 inconsistent: 3528
Related to #28468.