diff --git a/doc/xml/auto/metric-coverage-report.auto.xml b/doc/xml/auto/metric-coverage-report.auto.xml
index 6976857f7..10d592a2c 100644
--- a/doc/xml/auto/metric-coverage-report.auto.xml
+++ b/doc/xml/auto/metric-coverage-report.auto.xml
@@ -2,7 +2,7 @@
build/common
23/23 (100.0%)
56/56 (100.0%)
- 297/297 (100.0%)
+ 211/211 (100.0%)
@@ -37,327 +37,327 @@
command
15/15 (100.0%)
94/94 (100.0%)
- 239/239 (100.0%)
+ 192/192 (100.0%)
command/annotate
1/1 (100.0%)
12/12 (100.0%)
- 33/33 (100.0%)
+ 31/31 (100.0%)
command/archive
15/15 (100.0%)
104/104 (100.0%)
- 273/273 (100.0%)
+ 204/204 (100.0%)
command/archive/get
9/9 (100.0%)
200/200 (100.0%)
- 467/467 (100.0%)
+ 434/434 (100.0%)
command/archive/push
12/12 (100.0%)
130/130 (100.0%)
- 402/402 (100.0%)
+ 350/350 (100.0%)
command/backup
50/50 (100.0%)
796/796 (100.0%)
- 1896/1896 (100.0%)
+ 1660/1660 (100.0%)
command/check
13/13 (100.0%)
106/106 (100.0%)
- 272/272 (100.0%)
+ 217/217 (100.0%)
command/control
4/4 (100.0%)
34/34 (100.0%)
- 60/60 (100.0%)
+ 51/51 (100.0%)
command/expire
10/10 (100.0%)
240/240 (100.0%)
- 404/404 (100.0%)
+ 362/362 (100.0%)
command/help
7/7 (100.0%)
164/164 (100.0%)
- 291/291 (100.0%)
+ 261/261 (100.0%)
command/info
13/13 (100.0%)
366/366 (100.0%)
- 738/738 (100.0%)
+ 669/669 (100.0%)
command/local
1/1 (100.0%)
---
- 7/7 (100.0%)
+ 5/5 (100.0%)
command/remote
1/1 (100.0%)
6/6 (100.0%)
- 21/21 (100.0%)
+ 19/19 (100.0%)
command/repo
9/9 (100.0%)
110/110 (100.0%)
- 237/237 (100.0%)
+ 210/210 (100.0%)
command/restore
33/33 (100.0%)
684/684 (100.0%)
- 1410/1410 (100.0%)
+ 1258/1258 (100.0%)
command/server
6/6 (100.0%)
24/24 (100.0%)
- 88/88 (100.0%)
+ 81/81 (100.0%)
command/stanza
5/5 (100.0%)
106/106 (100.0%)
- 138/138 (100.0%)
+ 128/128 (100.0%)
command/verify
21/21 (100.0%)
314/314 (100.0%)
- 756/756 (100.0%)
+ 660/660 (100.0%)
common
144/144 (100.0%)
614/614 (100.0%)
- 1789/1789 (100.0%)
+ 1331/1331 (100.0%)
common/compress
13/13 (100.0%)
24/24 (100.0%)
- 122/122 (100.0%)
+ 75/75 (100.0%)
common/compress/bz2
13/13 (100.0%)
20/20 (100.0%)
- 173/173 (100.0%)
+ 133/133 (100.0%)
common/compress/gz
13/13 (100.0%)
26/26 (100.0%)
- 174/174 (100.0%)
+ 135/135 (100.0%)
common/compress/lz4
15/15 (100.0%)
24/24 (100.0%)
- 179/179 (100.0%)
+ 127/127 (100.0%)
common/compress/zst
13/13 (100.0%)
12/12 (100.0%)
- 146/146 (100.0%)
+ 106/106 (100.0%)
common/crypto
32/32 (100.0%)
88/88 (100.0%)
- 540/540 (100.0%)
+ 432/432 (100.0%)
common/error
33/33 (100.0%)
62/62 (100.0%)
- 188/188 (100.0%)
+ 178/178 (100.0%)
common/io
59/59 (100.0%)
174/174 (100.0%)
- 739/739 (100.0%)
+ 512/512 (100.0%)
common/io/filter
31/31 (100.0%)
92/92 (100.0%)
- 385/385 (100.0%)
+ 282/282 (100.0%)
common/io/http
57/57 (100.0%)
274/274 (100.0%)
- 875/875 (100.0%)
+ 673/673 (100.0%)
common/io/socket
28/28 (100.0%)
110/110 (100.0%)
- 446/446 (100.0%)
+ 343/343 (100.0%)
common/io/tls
36/36 (100.0%)
114/114 (100.0%)
- 536/536 (100.0%)
+ 399/399 (100.0%)
common/type
327/327 (100.0%)
898/898 (100.0%)
- 4244/4244 (100.0%)
+ 3032/3032 (100.0%)
config
93/93 (100.0%)
992/992 (100.0%)
- 1949/1949 (100.0%)
+ 1624/1624 (100.0%)
db
23/23 (100.0%)
118/118 (100.0%)
- 412/412 (100.0%)
+ 322/322 (100.0%)
info
92/92 (100.0%)
938/938 (100.0%)
- 2501/2501 (100.0%)
+ 2043/2043 (100.0%)
postgres
36/36 (100.0%)
130/130 (100.0%)
- 458/458 (100.0%)
+ 335/335 (100.0%)
postgres/interface
5/5 (100.0%)
12/12 (100.0%)
- 52/52 (100.0%)
+ 40/40 (100.0%)
protocol
62/62 (100.0%)
264/264 (100.0%)
- 1127/1127 (100.0%)
+ 891/891 (100.0%)
storage
56/56 (100.0%)
250/250 (100.0%)
- 850/850 (100.0%)
+ 628/628 (100.0%)
storage/azure
25/25 (100.0%)
138/138 (100.0%)
- 561/561 (100.0%)
+ 399/399 (100.0%)
storage/cifs
2/2 (100.0%)
---
- 18/18 (100.0%)
+ 6/6 (100.0%)
storage/gcs
34/34 (100.0%)
176/176 (100.0%)
- 786/786 (100.0%)
+ 579/579 (100.0%)
storage/posix
28/28 (100.0%)
167/168 (99.40%)
- 488/488 (100.0%)
+ 334/334 (100.0%)
storage/remote
38/38 (100.0%)
128/128 (100.0%)
- 785/785 (100.0%)
+ 581/581 (100.0%)
storage/s3
29/29 (100.0%)
184/184 (100.0%)
- 776/776 (100.0%)
+ 586/586 (100.0%)
storage/sftp
32/32 (100.0%)
404/404 (100.0%)
- 911/911 (100.0%)
+ 722/722 (100.0%)
TOTAL
1679/1679 (100.0%)
10667/10668 (99.99%)
- 31707/31707 (100.0%)
+ 25319/25319 (100.0%)
diff --git a/test/src/command/test/coverage.c b/test/src/command/test/coverage.c
index f2661a8a5..fc23b8b2c 100644
--- a/test/src/command/test/coverage.c
+++ b/test/src/command/test/coverage.c
@@ -1025,6 +1025,7 @@ testCvgGenerate(
strEqZ(vm, "none") ? "|vm_covered" : "");
RegExp *const regExpLine = regExpNew(regExpLineStr);
RegExp *const regExpLog = regExpNew(STRDEF("\\s+FUNCTION_(LOG|TEST)_(VOID|BEGIN|END|PARAM(|_P|_PP))\\("));
+ RegExp *const regExpLogReturn = regExpNew(STRDEF("\\s+FUNCTION_(LOG|TEST)_RETURN_VOID\\("));
for (unsigned int fileIdx = 0; fileIdx < lstSize(coverage->fileList); fileIdx++)
{
@@ -1041,10 +1042,15 @@ testCvgGenerate(
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)))
+ if (line->hit != 0)
{
- lstRemoveIdx(file->lineList, lineIdx);
- continue;
+ if (regExpMatch(regExpLog, strLstGet(lineTextList, line->no - 1)) ||
+ (regExpMatch(regExpLogReturn, strLstGet(lineTextList, line->no - 1)) &&
+ strEqZ(strLstGet(lineTextList, line->no), "}")))
+ {
+ lstRemoveIdx(file->lineList, lineIdx);
+ continue;
+ }
}
// If not covered then check for line coverage exceptions
diff --git a/test/src/module/test/coverageTest.c b/test/src/module/test/coverageTest.c
index 5637aced7..9a7724825 100644
--- a/test/src/module/test/coverageTest.c
+++ b/test/src/module/test/coverageTest.c
@@ -170,7 +170,7 @@ testRun(void)
/* 06 */ " logLevelAny = logLevelStdOut;\n"
/* 07 */ "\n"
/* 08 */ " if (logLevelStdErr > logLevelAny)\n"
- /* 09 */ " logLevelAny = logLevelStdErr;\n"
+ /* 09 */ " FUNCTION_LOG_RETURN_VOID();\n"
/* 10 */ "\n"
/* 11 */ " if (logLevelFile > logLevelAny && logFdFile != -1)\n"
/* 12 */ " logLevelAny = logLevelFile;\n"
@@ -276,6 +276,16 @@ testRun(void)
"\"junk\": 0,"
"\"line_number\": 8"
"},"
+ "{"
+ "\"branches\": [],"
+ "\"count\": 1,"
+ "\"line_number\": 9"
+ "},"
+ "{"
+ "\"branches\": [],"
+ "\"count\": 1,"
+ "\"line_number\": 14"
+ "},"
"{"
"\"branches\": [],"
"\"count\": 1,"
@@ -408,7 +418,7 @@ testRun(void)
TEST_RESULT_INT(testCvgGenerate(pathRepo, pathTest, STRDEF("vm"), true, moduleList), 2, "generate");
TEST_RESULT_LOG(
- "P00 WARN: module 'src/common/log.c' is not fully covered (3/8 lines, 1/2 branches)\n"
+ "P00 WARN: module 'src/common/log.c' is not fully covered (4/9 lines, 1/2 branches)\n"
"P00 WARN: module 'src/common/log2.c' is not fully covered (2/2 lines, 1/2 branches)");
TEST_STORAGE_GET(
@@ -417,7 +427,7 @@ testRun(void)
" common\n"
" 2/3 (66.67%)\n"
" 2/4 (50.00%)\n"
- " 5/10 (50.00%)\n"
+ " 6/11 (54.55%)\n"
"\n"
"\n"
"\n"
@@ -431,7 +441,7 @@ testRun(void)
" TOTAL\n"
" 3/4 (75.00%)\n"
" 2/4 (50.00%)\n"
- " 6/11 (54.55%)\n"
+ " 7/12 (58.33%)\n"
"\n");
// -------------------------------------------------------------------------------------------------------------------------
@@ -439,7 +449,7 @@ testRun(void)
TEST_RESULT_INT(testCvgGenerate(pathRepo, pathTest, STRDEF("vm"), false, moduleList), 2, "generate");
TEST_RESULT_LOG(
- "P00 WARN: module 'src/common/log.c' is not fully covered (4/8 lines, 1/2 branches)\n"
+ "P00 WARN: module 'src/common/log.c' is not fully covered (5/9 lines, 1/2 branches)\n"
"P00 WARN: module 'src/common/log2.c' is not fully covered (2/2 lines, 1/2 branches)");
TEST_STORAGE_GET(
@@ -474,7 +484,7 @@ testRun(void)
TEST_CVG_HTML_RPT_LINE_PRE "8" TEST_CVG_HTML_RPT_BRANCH_UNCOVERED_PRE "[+ -]" TEST_CVG_HTML_RPT_BRANCH_UNCOVERED_POST
TEST_CVG_HTML_RPT_CODE " if (logLevelStdErr > logLevelAny)" TEST_CVG_HTML_RPT_LINE_POST
TEST_CVG_HTML_RPT_LINE_PRE "9" TEST_CVG_HTML_RPT_BRANCH_COVERED
- TEST_CVG_HTML_RPT_CODE " logLevelAny = logLevelStdErr;" TEST_CVG_HTML_RPT_LINE_POST
+ TEST_CVG_HTML_RPT_CODE " FUNCTION_LOG_RETURN_VOID();" TEST_CVG_HTML_RPT_LINE_POST
TEST_CVG_HTML_RPT_LINE_PRE "10" TEST_CVG_HTML_RPT_BRANCH_COVERED
TEST_CVG_HTML_RPT_CODE "" TEST_CVG_HTML_RPT_LINE_POST
TEST_CVG_HTML_RPT_LINE_PRE "11" TEST_CVG_HTML_RPT_BRANCH_COVERED