mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-04 03:49:14 +02:00
87f36e814e
The branch coverage exclusion rules were overly broad and included functions that ended in a capital letter, which disabled all coverage for the statement. Improve matching so that all characters in the name must be upper-case for a match. Some macros with internal branches accepted parameters that might contain conditionals. This made it impossible to tell which branches belonged to which, and in any case an overzealous exclusion rule was ignoring all branches in such cases. Add the DEBUG_COVERAGE flag to build a modified version of the macros without any internal branches to be used for coverage testing. In most cases, the branches were optimizations (like checking logWill()) that improve production performance but are not needed for testing. In other cases, a parameter needed to be added to the underlying function to handle the branch during coverage testing. Also tweak the coverage rules so that macros without conditionals are automatically excluded from branch coverage as long as they are not themselves a parameter. Finally, update tests and code where missing coverage was exposed by these changes. Some code was updated to remove existing coverage exclusions when it was a simple change.
1.5 KiB
1.5 KiB
Release Build Instructions
Generate Coverage Report
These instructions are temporary until a fully automated report is implemented.
- In
test/src/lcov.conf
remove:
# Specify the regular expression of lines to exclude
lcov_excl_line=lcov_excl_line=\{\+{0,1}uncovered[^_]|\{\+{0,1}uncoverable[^_]
# Coverage rate limits
genhtml_hi_limit = 100
genhtml_med_limit = 90
And change uncover(ed|able)_branch
to uncoverable_branch
.
- In
test/lib/pgBackRestTest/Common/JobTest.pm
modify:
if (!$bTest || $iTotalLines != $iCoveredLines || $iTotalBranches != $iCoveredBranches)
to:
if (!$bTest)
- Run:
/backrest/test/test.pl --dev-test --vm=u18 --c-only
- Copy coverage report:
cd <pgbackrest-base>/doc/site
rm -rf coverage
cp -r ../../test/coverage/c coverage
- In
doc/site/coverage
replace:
<title>LCOV - all.lcov</title>
with:
<title>pgBackRest vX.XX C Code Coverage</title>
- In
doc/site/coverage
replace:
<tr><td class="title">LCOV - code coverage report</td></tr>
with:
<tr><td class="title">pgBackRest vX.XX C Code Coverage</td></tr>
- In
doc/site/coverage
replace:
<title>LCOV - all.lcov -
with:
<title>pgBackRest vX.XX C Code Coverage -
- In
doc/site/coverage
replace:
<td class="headerValue">all.lcov</td>
with:
<td class="headerValue">all C unit</td>
- Switch to prior dir and copy coverage:
cd prior/X.XX
rm -rf coverage
cp -r ../../coverage .