1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-15 01:04:37 +02:00

Add --no-coverage-report to test.pl to disable report generation.

There is no sense in generating detailed coverage reports in CI environments where they will never be seen. It takes time and format differences in some older versions can cause problems in the report generation code.

Note that missing coverage will still be reported on stdout and the test will fail.
This commit is contained in:
David Steele
2020-06-17 15:07:30 -04:00
parent ea984c4d3e
commit 417818dcca
3 changed files with 27 additions and 13 deletions

View File

@ -222,6 +222,7 @@ sub coverageValidateAndGenerate
{
my $oyTestRun = shift;
my $oStorage = shift;
my $bCoverageReport = shift;
my $bCoverageSummary = shift;
my $strWorkPath = shift;
my $strWorkTmpPath = shift;
@ -287,17 +288,10 @@ sub coverageValidateAndGenerate
# Generate C coverage report
#---------------------------------------------------------------------------------------------------------------------------
&log(INFO, 'writing C coverage report');
my $strLCovFile = "${strWorkTmpPath}/all.lcov";
if ($oStorage->exists($strLCovFile))
{
executeTest(
"genhtml ${strLCovFile} --config-file=${strTestResultCoveragePath}/raw/lcov.conf" .
" --prefix=${strWorkPath}/repo" .
" --output-directory=${strTestResultCoveragePath}/lcov");
foreach my $strCodeModule (sort(keys(%{$hCoverageActual})))
{
my $strCoverageFile = $strCodeModule;
@ -344,8 +338,23 @@ sub coverageValidateAndGenerate
}
}
coverageGenerate(
$oStorage, "${strWorkPath}/repo", "${strTestResultCoveragePath}/raw", "${strTestResultCoveragePath}/coverage.html");
if ($result == 0)
{
&log(INFO, "tested modules have full coverage");
}
if ($bCoverageReport)
{
&log(INFO, 'writing C coverage report');
executeTest(
"genhtml ${strLCovFile} --config-file=${strTestResultCoveragePath}/raw/lcov.conf" .
" --prefix=${strWorkPath}/repo" .
" --output-directory=${strTestResultCoveragePath}/lcov");
coverageGenerate(
$oStorage, "${strWorkPath}/repo", "${strTestResultCoveragePath}/raw", "${strTestResultCoveragePath}/coverage.html");
}
if ($bCoverageSummary)
{
@ -355,9 +364,11 @@ sub coverageValidateAndGenerate
$oStorage, "${strTestResultCoveragePath}/raw", "${strTestResultSummaryPath}/metric-coverage-report.auto.xml");
}
}
else
# Remove coverage report when no coverage or no report to avoid confusion from looking at an old report
if (!$bCoverageReport || !$oStorage->exists($strLCovFile))
{
executeTest("rm -rf ${strTestResultCoveragePath}/test/tesult/coverage");
executeTest("rm -rf ${strTestResultCoveragePath}");
}
return $result;