You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-07 00:35:37 +02:00
Exclude function logging macros from coverage reporting.
It makes sense to exclude these from reporting since they are always covered when the function is covered and they are purely for debugging.
This commit is contained in:
@ -1024,20 +1024,29 @@ testCvgGenerate(
|
|||||||
"\\{\\+{0,1}(%s%s)[^_]", coverageSummary ? "uncoverable" : "uncover(ed|able)",
|
"\\{\\+{0,1}(%s%s)[^_]", coverageSummary ? "uncoverable" : "uncover(ed|able)",
|
||||||
strEqZ(vm, "none") ? "|vm_covered" : "");
|
strEqZ(vm, "none") ? "|vm_covered" : "");
|
||||||
RegExp *const regExpLine = regExpNew(regExpLineStr);
|
RegExp *const regExpLine = regExpNew(regExpLineStr);
|
||||||
|
RegExp *const regExpLog = regExpNew(STRDEF("\\s+FUNCTION_(LOG|TEST)_(VOID|BEGIN|END|PARAM(|_P|_PP))\\("));
|
||||||
|
|
||||||
for (unsigned int fileIdx = 0; fileIdx < lstSize(coverage->fileList); fileIdx++)
|
for (unsigned int fileIdx = 0; fileIdx < lstSize(coverage->fileList); fileIdx++)
|
||||||
{
|
{
|
||||||
MEM_CONTEXT_TEMP_BEGIN()
|
MEM_CONTEXT_TEMP_BEGIN()
|
||||||
{
|
{
|
||||||
|
unsigned int lineIdx = 0;
|
||||||
const TestCoverageFile *const file = lstGet(coverage->fileList, fileIdx);
|
const TestCoverageFile *const file = lstGet(coverage->fileList, fileIdx);
|
||||||
const StringList *const lineTextList = strLstNewSplitZ(
|
const StringList *const lineTextList = strLstNewSplitZ(
|
||||||
strNewBuf(storageGetP(storageNewReadP(storageTest, strNewFmt("repo/%s", strZ(file->name))))), "\n");
|
strNewBuf(storageGetP(storageNewReadP(storageTest, strNewFmt("repo/%s", strZ(file->name))))), "\n");
|
||||||
|
|
||||||
for (unsigned int lineIdx = 0; lineIdx < lstSize(file->lineList); lineIdx++)
|
while (lineIdx < lstSize(file->lineList))
|
||||||
{
|
{
|
||||||
ASSERT(lineIdx < strLstSize(lineTextList));
|
ASSERT(lineIdx < strLstSize(lineTextList));
|
||||||
TestCoverageLine *const line = lstGet(file->lineList, lineIdx);
|
TestCoverageLine *const line = lstGet(file->lineList, lineIdx);
|
||||||
|
|
||||||
|
// Remove covered lines for debug logging. These are not very interesting for coverage reporting.
|
||||||
|
if (line->hit != 0 && regExpMatch(regExpLog, strLstGet(lineTextList, line->no - 1)))
|
||||||
|
{
|
||||||
|
lstRemoveIdx(file->lineList, lineIdx);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// If not covered then check for line coverage exceptions
|
// If not covered then check for line coverage exceptions
|
||||||
if (line->hit == 0 && regExpMatch(regExpLine, strLstGet(lineTextList, line->no - 1)))
|
if (line->hit == 0 && regExpMatch(regExpLine, strLstGet(lineTextList, line->no - 1)))
|
||||||
line->hit = 1;
|
line->hit = 1;
|
||||||
@ -1049,6 +1058,8 @@ testCvgGenerate(
|
|||||||
lstFree(line->branchList);
|
lstFree(line->branchList);
|
||||||
line->branchList = NULL;
|
line->branchList = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lineIdx++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
@ -276,6 +276,11 @@ testRun(void)
|
|||||||
"\"junk\": 0,"
|
"\"junk\": 0,"
|
||||||
"\"line_number\": 8"
|
"\"line_number\": 8"
|
||||||
"},"
|
"},"
|
||||||
|
"{"
|
||||||
|
"\"branches\": [],"
|
||||||
|
"\"count\": 1,"
|
||||||
|
"\"line_number\": 21"
|
||||||
|
"},"
|
||||||
"{"
|
"{"
|
||||||
"\"branches\": [],"
|
"\"branches\": [],"
|
||||||
"\"count\": 0,"
|
"\"count\": 0,"
|
||||||
|
Reference in New Issue
Block a user