You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-17 01:12:23 +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:
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -94,6 +94,7 @@ test.pl [options]
|
||||
--expect --vm=co7 --pg-version=9.6 --log-force
|
||||
--no-valgrind don't run valgrind on C unit tests (saves time)
|
||||
--no-coverage don't run coverage on C unit tests (saves time)
|
||||
--no-coverage-report run coverage but don't generate coverage report (saves time)
|
||||
--no-optimize don't do compile optimization for C (saves compile time)
|
||||
--backtrace enable backtrace when available (adds stack trace line numbers -- very slow)
|
||||
--profile generate profile info
|
||||
@ -160,6 +161,7 @@ my $iBuildMax = 4;
|
||||
my $bCoverageOnly = false;
|
||||
my $bCoverageSummary = false;
|
||||
my $bNoCoverage = false;
|
||||
my $bNoCoverageReport = false;
|
||||
my $bCOnly = false;
|
||||
my $bContainerOnly = false;
|
||||
my $bNoPerformance = false;
|
||||
@ -213,6 +215,7 @@ GetOptions ('q|quiet' => \$bQuiet,
|
||||
'coverage-only' => \$bCoverageOnly,
|
||||
'coverage-summary' => \$bCoverageSummary,
|
||||
'no-coverage' => \$bNoCoverage,
|
||||
'no-coverage-report' => \$bNoCoverageReport,
|
||||
'c-only' => \$bCOnly,
|
||||
'container-only' => \$bContainerOnly,
|
||||
'no-performance' => \$bNoPerformance,
|
||||
@ -1157,7 +1160,7 @@ eval
|
||||
if (vmCoverageC($strVm) && !$bNoCoverage && !$bDryRun && $iTestFail == 0)
|
||||
{
|
||||
$iUncoveredCodeModuleTotal = coverageValidateAndGenerate(
|
||||
$oyTestRun, $oStorageBackRest, $bCoverageSummary, $strTestPath, "${strTestPath}/temp",
|
||||
$oyTestRun, $oStorageBackRest, !$bNoCoverageReport, $bCoverageSummary, $strTestPath, "${strTestPath}/temp",
|
||||
"${strBackRestBase}/test/result", "${strBackRestBase}/doc/xml/auto");
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ eval
|
||||
|
||||
processBegin(($strVm eq VM_NONE ? "no container" : $strVm) . ' test');
|
||||
processExec(
|
||||
"${strTestExe} --no-gen --vm-host=none --vm-max=2 --vm=${strVm}" .
|
||||
"${strTestExe} --no-gen --no-coverage-report --vm-host=none --vm-max=2 --vm=${strVm}" .
|
||||
(@stryParam != 0 ? " --" . join(" --", @stryParam) : ''),
|
||||
{bShowOutputAsync => true, bOutLogOnError => false});
|
||||
processEnd();
|
||||
|
Reference in New Issue
Block a user