1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2026-05-22 10:15:16 +02:00

Move raw coverage results to test/result/raw path.

These results were stored in the vagrant path along with a full copy of src.

Instead store the raw coverage data in test/result/raw and change source references to the files that already exist in [test-path]/repo.
This commit is contained in:
David Steele
2020-03-16 08:41:32 -04:00
parent d702249507
commit 4328bc1ac6
3 changed files with 35 additions and 28 deletions
+13 -7
View File
@@ -71,6 +71,7 @@ push @EXPORT, qw(coverageLCovConfigGenerate);
sub coverageGenerate
{
my $oStorage = shift;
my $strBasePath = shift;
my $strCoveragePath = shift;
my $strOutFile = shift;
@@ -87,8 +88,7 @@ sub coverageGenerate
my $strCoverage = ${$oStorage->get("${strCoveragePath}/${strFileCov}")};
# Show that the file is part of the coverage report even if there is no missing coverage
my $strFile = substr($strFileCov, 0, length($strFileCov) - 5) . '.c';
$rhCoverage->{$strFile} = undef;
my $strFile;
my $iBranchLine = -1;
my $iBranch = undef;
@@ -97,8 +97,14 @@ sub coverageGenerate
foreach my $strLine (split("\n", $strCoverage))
{
# Get source file name
if ($strLine =~ /^SF\:/)
{
$strFile = substr($strLine, 3);
$rhCoverage->{$strFile} = undef;
}
# Check branch coverage
if ($strLine =~ /^BRDA\:/)
elsif ($strLine =~ /^BRDA\:/)
{
my @stryData = split("\,", substr($strLine, 5));
@@ -216,7 +222,7 @@ sub coverageGenerate
{
if (defined($rhCoverage->{$strFile}{line}))
{
my $strC = ${$oStorage->get("${strCoveragePath}/${strFile}")};
my $strC = ${$oStorage->get($strFile)};
my @stryC = split("\n", $strC);
foreach my $iLine (sort(keys(%{$rhCoverage->{$strFile}{line}})))
@@ -435,7 +441,7 @@ sub coverageGenerate
foreach my $strFile (sort(keys(%{$rhCoverage})))
{
my $oRow = $oTable->addNew(HTML_TR, 'list-table-row-' . (defined($rhCoverage->{$strFile}{line}) ? 'uncovered' : 'covered'));
$oRow->addNew(HTML_TD, 'list-table-row-file', {strContent => $strFile});
$oRow->addNew(HTML_TD, 'list-table-row-file', {strContent => substr($strFile, length($strBasePath) + 1)});
}
# Report on files that are missing coverage
@@ -446,14 +452,14 @@ sub coverageGenerate
# Build the file report table
$oTable = $oHtml->bodyGet()->addNew(HTML_TABLE, 'report-table');
$oTable->addNew(HTML_DIV, 'report-table-caption', {strContent => "${strFile}"});
$oTable->addNew(HTML_DIV, 'report-table-caption', {strContent => substr($strFile, length($strBasePath) + 1)});
$oHeader = $oTable->addNew(HTML_TR, 'report-table-header');
$oHeader->addNew(HTML_TH, 'report-table-header-line', {strContent => 'LINE'});
$oHeader->addNew(HTML_TH, 'report-table-header-branch', {strContent => 'BRANCH'});
$oHeader->addNew(HTML_TH, 'report-table-header-code', {strContent => 'CODE'});
my $strC = ${$oStorage->get("${strCoveragePath}/${strFile}")};
my $strC = ${$oStorage->get($strFile)};
my @stryC = split("\n", $strC);
my $iLastLine = undef;
+9 -5
View File
@@ -626,7 +626,7 @@ sub end
"module/$self->{oTest}->{&TEST_MODULE}/" . testRunName($self->{oTest}->{&TEST_NAME}, false) . 'Test');
# Generate coverage reports for the modules
my $strLCovConf = $self->{strBackRestBase} . '/test/.vagrant/code/lcov.conf';
my $strLCovConf = $self->{strBackRestBase} . '/test/result/coverage/raw/lcov.conf';
coverageLCovConfigGenerate($self->{oStorageTest}, $strLCovConf, $self->{bCoverageSummary});
my $strLCovExeBase = "lcov --config-file=${strLCovConf}";
@@ -659,9 +659,12 @@ sub end
}
# Generate lcov reports
my $strModulePath = $self->{strBackRestBase} . "/test/.vagrant/code/${strModuleOutName}";
my $strLCovFile = "${strModulePath}.lcov";
my $strLCovTotal = $self->{strBackRestBase} . "/test/.vagrant/code/all.lcov";
my $strModulePath =
$self->{strTestPath} . "/repo/" .
(${strModuleOutName} =~ /^test\// ?
'test/src/module/' . substr(${strModuleOutName}, 5) : "src/${strModuleOutName}");
my $strLCovFile = $self->{strBackRestBase} . "/test/result/coverage/raw/${strModuleOutName}.lcov";
my $strLCovTotal = $self->{strTestPath} . "/temp/all.lcov";
executeTest(
"${strLCovExe} --extract=${strLCovOut} */${strModuleName}.c --o=${strLCovOutTmp}");
@@ -709,7 +712,8 @@ sub end
# Fix source file name
$strCoverage =~ s/^SF\:.*$/SF:$strModulePath\.c/mg;
$self->{oStorageTest}->put($strLCovFile, $strCoverage);
$self->{oStorageTest}->put(
$self->{oStorageTest}->openWrite($strLCovFile, {bPathCreate => true}), $strCoverage);
if ($self->{oStorageTest}->exists($strLCovTotal))
{