Improve macros and coverage rules that were hiding missing coverage.

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.
This commit is contained in:
David Steele
2019-05-11 14:51:51 -04:00
parent f819a32cdf
commit 87f36e814e
38 changed files with 279 additions and 123 deletions
+3 -1
View File
@@ -7,13 +7,15 @@ 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=\{\+*uncovered|\{\+*uncoverable
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)