You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2026-05-22 10:15:16 +02:00
Allow modules to be included for testing without requiring coverage.
Sometimes it is useful to get at the internals of a module that is not being tested for coverage in order to provide coverage for another module that is being tested. The include directive allows this. Update modules that had previously been added to coverage that only need to be included.
This commit is contained in:
@@ -53,6 +53,8 @@ use constant TESTDEF_DEFINE_TEST => 'define-t
|
||||
push @EXPORT, qw(TESTDEF_DEFINE_TEST);
|
||||
use constant TESTDEF_DEBUG_UNIT_SUPPRESS => 'debugUnitSuppress';
|
||||
push @EXPORT, qw(TESTDEF_DEBUG_UNIT_SUPPRESS);
|
||||
use constant TESTDEF_INCLUDE => 'include';
|
||||
push @EXPORT, qw(TESTDEF_INCLUDE);
|
||||
use constant TESTDEF_INDIVIDUAL => 'individual';
|
||||
push @EXPORT, qw(TESTDEF_INDIVIDUAL);
|
||||
use constant TESTDEF_TOTAL => 'total';
|
||||
@@ -180,6 +182,9 @@ sub testDefLoad
|
||||
push(@{$hCoverageList->{$strCodeModule}}, {strModule=> $strModule, strTest => $strTest});
|
||||
}
|
||||
}
|
||||
|
||||
# Set include list
|
||||
$hTestDefHash->{$strModule}{$strTest}{&TESTDEF_INCLUDE} = $hModuleTest->{&TESTDEF_INCLUDE};
|
||||
}
|
||||
|
||||
$hModuleTest->{$strModule} = \@stryModuleTest;
|
||||
|
||||
@@ -291,6 +291,8 @@ sub run
|
||||
|
||||
foreach my $strFile (sort(keys(%{$self->{oStorageTest}->manifest($self->{strGCovPath})})))
|
||||
{
|
||||
my $strFileNoExt = substr($strFile, 0, length($strFile) - 2);
|
||||
|
||||
# Skip all files except .c files (including .auto.c)
|
||||
next if $strFile !~ /(?<!\.auto)\.c$/;
|
||||
|
||||
@@ -300,7 +302,7 @@ sub run
|
||||
# Skip test.c -- it will be added manually at the end
|
||||
next if $strFile =~ /test\.c$/;
|
||||
|
||||
if (!defined($hTestCoverage->{substr($strFile, 0, length($strFile) - 2)}) &&
|
||||
if (!defined($hTestCoverage->{$strFileNoExt}) && !grep(/^$strFileNoExt$/, @{$hTest->{&TESTDEF_INCLUDE}}) &&
|
||||
$strFile !~ /^test\/module\/[^\/]*\/.*Test\.c$/)
|
||||
{
|
||||
push(@stryCFile, "${strFile}");
|
||||
@@ -313,7 +315,7 @@ sub run
|
||||
"test/module/$self->{oTest}->{&TEST_MODULE}/" . testRunName($self->{oTest}->{&TEST_NAME}, false) . 'Test.c';
|
||||
my $strCInclude;
|
||||
|
||||
foreach my $strFile (sort(keys(%{$hTestCoverage})))
|
||||
foreach my $strFile (sort(keys(%{$hTestCoverage}), @{$hTest->{&TESTDEF_INCLUDE}}))
|
||||
{
|
||||
# Don't include the test file as it is already included below
|
||||
next if $strFile =~ /Test$/;
|
||||
|
||||
Reference in New Issue
Block a user