Skip to content

Commit

Permalink
Automate coverage summary report generation.
Browse files Browse the repository at this point in the history
This report replaces the lcov report that was generated manually for each release.

The lcov report was overly verbose just to say that we have virtually 100% coverage.
  • Loading branch information
dwsteele committed May 15, 2019
1 parent 5bba72b commit 5c1d4bc
Show file tree
Hide file tree
Showing 13 changed files with 505 additions and 115 deletions.
80 changes: 1 addition & 79 deletions doc/RELEASE.md
@@ -1,81 +1,3 @@
# Release Build Instructions

## Generate Coverage Report

These instructions are temporary until a fully automated report is implemented.

- In `test/src/lcov.conf` remove:
```
# Specify the regular expression of lines to exclude
lcov_excl_line=lcov_excl_line=\{\+{0,1}uncovered[^_]|\{\+{0,1}uncoverable[^_]
# Coverage rate limits
genhtml_hi_limit = 100
genhtml_med_limit = 90
```

And change `uncover(ed|able)_branch` to `uncoverable_branch`.

- In `test/lib/pgBackRestTest/Common/JobTest.pm` modify:
```
if (!$bTest || $iTotalLines != $iCoveredLines || $iTotalBranches != $iCoveredBranches)
```
to:
```
if (!$bTest)
```

- Run:
```
/backrest/test/test.pl --dev-test --vm=u18 --c-only
```

- Copy coverage report:
```
cd <pgbackrest-base>/doc/site
rm -rf coverage
cp -r ../../test/coverage/c coverage
```

- In `doc/site/coverage` replace:
```
<title>LCOV - all.lcov</title>
```
with:
```
<title>pgBackRest vX.XX C Code Coverage</title>
```

- In `doc/site/coverage` replace:
```
<tr><td class="title">LCOV - code coverage report</td></tr>
```
with:
```
<tr><td class="title">pgBackRest vX.XX C Code Coverage</td></tr>
```

- In `doc/site/coverage` replace:
```
<title>LCOV - all.lcov -
```
with:
```
<title>pgBackRest vX.XX C Code Coverage -
```

- In `doc/site/coverage` replace:
```
<td class="headerValue">all.lcov</td>
```
with:
```
<td class="headerValue">all C unit</td>
```

- Switch to prior dir and copy coverage:
```
cd prior/X.XX
rm -rf coverage
cp -r ../../coverage .
```
## Run `doc/release.pl`
2 changes: 1 addition & 1 deletion doc/lib/BackRestDoc/Html/DocHtmlPage.pm
Expand Up @@ -433,7 +433,7 @@ sub sectionProcess

$oHeaderRowElement->addNew(
HTML_TH,
"table-header-${strAlign}" . ($bFill ? ",table-header-fill" : ""),
"table-header-${strAlign}" . ($bFill ? " table-header-fill" : ""),
{strContent => $self->processText($oColumn->textGet())});
}
}
Expand Down
2 changes: 2 additions & 0 deletions doc/manifest.xml
Expand Up @@ -84,6 +84,7 @@
<source key="user-guide"/>
<source key="reference" type="custom"/>
<source key="release" type="custom"/>
<source key="metric"/>
<source key="coding"/>
<source key="documentation"/>
<source key="test"/>
Expand All @@ -96,6 +97,7 @@
<render-source key="release" menu="Releases"/>
<render-source key="configuration" source="reference" menu="Configuration"/>
<render-source key="command" source="reference" menu="Commands"/>
<render-source key="metric" menu="Metrics"/>
</render>

<render type="pdf" file="{[pdf-file]}">
Expand Down
15 changes: 14 additions & 1 deletion doc/release.pl
Expand Up @@ -62,6 +62,7 @@ =head1 SYNOPSIS
Release Options:
--build Build the cache before release (should be included in the release commit)
--deploy Deploy documentation to website (can be done as docs are updated)
--no-coverage Don't generate the coverage report
=cut

####################################################################################################################################
Expand All @@ -73,13 +74,15 @@ =head1 SYNOPSIS
my $strLogLevel = 'info';
my $bBuild = false;
my $bDeploy = false;
my $bNoCoverage = false;

GetOptions ('help' => \$bHelp,
'version' => \$bVersion,
'quiet' => \$bQuiet,
'log-level=s' => \$strLogLevel,
'build' => \$bBuild,
'deploy' => \$bDeploy)
'deploy' => \$bDeploy,
'no-coverage' => \$bNoCoverage)
or pod2usage(2);

####################################################################################################################################
Expand Down Expand Up @@ -119,6 +122,7 @@ =head1 SYNOPSIS
my $strDocPath = dirname(abs_path($0));
my $strDocHtml = "${strDocPath}/output/html";
my $strDocExe = "${strDocPath}/doc.pl";
my $strTestExe = dirname($strDocPath) . "/test/test.pl";

my $oStorageDoc = new pgBackRest::Storage::Local(
$strDocPath, new pgBackRest::Storage::Posix::Driver({bFileSync => false, bPathSync => false}));
Expand All @@ -135,6 +139,15 @@ =head1 SYNOPSIS
# Remove all docker containers to get consistent IP address assignments
executeTest('docker rm -f $(docker ps -a -q)', {bSuppressError => true});

# Generate coverage summmary
if (!$bNoCoverage)
{
&log(INFO, "Generate Coverage Summary");
executeTest(
"${strTestExe} --no-lint --no-package --no-valgrind --no-optimize --vm-max=3 --coverage-summary",
{bShowOutputAsync => true});
}

# Generate deployment docs for RHEL/Centos 7
&log(INFO, "Generate RHEL/CentOS 7 documentation");

Expand Down
17 changes: 17 additions & 0 deletions doc/resource/html/default.css
Expand Up @@ -304,6 +304,7 @@ Table Elements
.table
{
margin-top: .5em;
border-spacing: .5em 0;
}

.table-caption
Expand All @@ -318,6 +319,14 @@ Table Elements
{
}

.table-header-left,
.table-header-center,
.table-header-right
{
white-space: nowrap;
border-bottom: 1px black solid;
}

.table-header-left
{
text-align: left;
Expand All @@ -342,8 +351,16 @@ Table Elements
{
}

.table-data-left,
.table-data-center,
.table-data-right
{
white-space: nowrap;
}

.table-data-left
{
padding-top: 0px;
text-align: left;
}

Expand Down

0 comments on commit 5c1d4bc

Please sign in to comment.