Only build C binary/library for Perl unit/integration tests.
+
Only build C binary/library for Perl unit/integration tests or C unit tests that require Perl.
diff --git a/test/lib/pgBackRestTest/Common/DefineTest.pm b/test/lib/pgBackRestTest/Common/DefineTest.pm
index 46847ea05..7dac7b758 100644
--- a/test/lib/pgBackRestTest/Common/DefineTest.pm
+++ b/test/lib/pgBackRestTest/Common/DefineTest.pm
@@ -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);
diff --git a/test/lib/pgBackRestTest/Common/JobTest.pm b/test/lib/pgBackRestTest/Common/JobTest.pm
index 43eda1dce..4e8906bc5 100644
--- a/test/lib/pgBackRestTest/Common/JobTest.pm
+++ b/test/lib/pgBackRestTest/Common/JobTest.pm
@@ -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);
}
diff --git a/test/lib/pgBackRestTest/Common/ListTest.pm b/test/lib/pgBackRestTest/Common/ListTest.pm
index 945e255ea..26404520e 100644
--- a/test/lib/pgBackRestTest/Common/ListTest.pm
+++ b/test/lib/pgBackRestTest/Common/ListTest.pm
@@ -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 =>
diff --git a/test/test.pl b/test/test.pl
index b73da5049..2d108f2fd 100755
--- a/test/test.pl
+++ b/test/test.pl
@@ -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;