1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-09-16 09:06:18 +02:00

Build C binary/library for C unit tests that require Perl.

This commit is contained in:
David Steele
2018-02-14 10:33:21 -05:00
parent fda62dfc48
commit a907fd7d2d
5 changed files with 15 additions and 8 deletions

View File

@@ -154,7 +154,7 @@
</release-item>
<release-item>
<p>Only build C binary/library for Perl unit/integration tests.</p>
<p>Only build C binary/library for Perl unit/integration tests or C unit tests that require Perl.</p>
</release-item>
<release-item>

View File

@@ -52,6 +52,9 @@ use constant TESTDEF_INDIVIDUAL => 'individu
# Total runs in the test
use constant TESTDEF_TOTAL => 'total';
push @EXPORT, qw(TESTDEF_TOTAL);
# Is Perl required for this C test?
use constant TESTDEF_PERL_REQ => 'perlReq';
push @EXPORT, qw(TESTDEF_PERL_REQ);
# VMs that the test can run on
use constant TESTDEF_VM => 'vm';
push @EXPORT, qw(TESTDEF_VM);
@@ -905,7 +908,8 @@ foreach my $hModule (@{$oTestDef->{&TESTDEF_MODULE}})
# Resolve variables that can be set in the module or the test
foreach my $strVar (
TESTDEF_C, TESTDEF_CDEF, TESTDEF_CONTAINER, TESTDEF_EXPECT, TESTDEF_DB, TESTDEF_INDIVIDUAL, TESTDEF_VM)
TESTDEF_C, TESTDEF_CDEF, TESTDEF_CONTAINER, TESTDEF_EXPECT, TESTDEF_DB, TESTDEF_INDIVIDUAL, TESTDEF_PERL_REQ,
TESTDEF_VM)
{
$hTestDefHash->{$strModule}{$strTest}{$strVar} = coalesce(
$hModuleTest->{$strVar}, $hModule->{$strVar}, $strVar eq TESTDEF_VM ? undef : false);

View File

@@ -179,8 +179,8 @@ sub run
"cp -r $self->{strBackRestBase}/test/src/* $self->{strGCovPath}");
}
# If testing Perl code install bin and Perl C Library
if (!$self->{oTest}->{&TEST_C})
# If testing Perl code (or C code that calls Perl code) install bin and Perl C Library
if (!$self->{oTest}->{&TEST_C} || $self->{oTest}->{&TEST_PERL_REQ})
{
jobInstallC($self->{strBackRestBase}, $self->{oTest}->{&TEST_VM}, $strImage);
}

View File

@@ -34,14 +34,16 @@ use constant TEST_MODULE => 'module';
push @EXPORT, qw(TEST_MODULE);
use constant TEST_NAME => 'test';
push @EXPORT, qw(TEST_NAME);
use constant TEST_PERL_ARCH_PATH => VMDEF_PERL_ARCH_PATH;
push @EXPORT, qw(TEST_PERL_ARCH_PATH);
use constant TEST_PERL_REQ => 'perl-req';
push @EXPORT, qw(TEST_PERL_REQ);
use constant TEST_PGSQL_BIN => 'pgsql-bin';
push @EXPORT, qw(TEST_PGSQL_BIN);
use constant TEST_RUN => 'run';
push @EXPORT, qw(TEST_RUN);
use constant TEST_VM => 'os';
push @EXPORT, qw(TEST_VM);
use constant TEST_PERL_ARCH_PATH => VMDEF_PERL_ARCH_PATH;
push @EXPORT, qw(TEST_PERL_ARCH_PATH);
####################################################################################################################################
# testListGet
@@ -149,6 +151,7 @@ sub testListGet
$hTest->{&TESTDEF_CONTAINER} : $hModule->{&TESTDEF_CONTAINER},
&TEST_PGSQL_BIN => $strPgSqlBin,
&TEST_PERL_ARCH_PATH => $$oyVm{$strTestOS}{&VMDEF_PERL_ARCH_PATH},
&TEST_PERL_REQ => $hTest->{&TESTDEF_PERL_REQ},
&TEST_MODULE => $strModule,
&TEST_NAME => $strModuleTest,
&TEST_RUN =>

View File

@@ -436,7 +436,7 @@ eval
my $oyTestRun;
my $bBuildRequired = false;
# Only get the test list if when they can run
# Only get the test list when they can run
if (!$bBuildOnly)
{
# Get the test list
@@ -447,7 +447,7 @@ eval
# all the tests are C unit tests then no builds are required. This saves a lot ot time.
foreach my $hTest (@{$oyTestRun})
{
if (!$hTest->{&TESTDEF_C})
if (!$hTest->{&TEST_C} || $hTest->{&TEST_PERL_REQ})
{
$bBuildRequired = true;
last;