mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
Allow parameters to be passed to travis.pl.
This makes configuring tests easier. Also add a parameter for tests that require sudo. This should be retired at some point but some tests still require it.
This commit is contained in:
parent
f3b2189659
commit
b4aeb217e6
20
.travis.yml
20
.travis.yml
@ -13,17 +13,19 @@ services:
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- env: PGB_CI="--vm=u12 test"
|
||||
- env: PGB_CI="--vm=f30 test"
|
||||
- env: PGB_CI="--vm=co6 test"
|
||||
- env: PGB_CI="--vm=u18 test"
|
||||
- env: PGB_CI="--vm=u18 doc"
|
||||
- env: PGB_CI="--vm=co7 test"
|
||||
- env: PGB_CI="test --vm=u12 --sudo"
|
||||
- env: PGB_CI="test --vm=f30 --param=no-package --param=c-only"
|
||||
- env: PGB_CI="test --vm=co6 --param=module=real"
|
||||
- env: PGB_CI="test --vm=u18 --sudo --param=container-only"
|
||||
- env: PGB_CI=" doc --vm=u18"
|
||||
- env: PGB_CI="test --vm=co7 --param=module=real"
|
||||
- dist: bionic
|
||||
env: PGB_CI="--vm=none test"
|
||||
env:
|
||||
- PGB_CI="test --vm=none"
|
||||
- TZ="America/New_York"
|
||||
services:
|
||||
- env: PGB_CI="--vm=co6 doc"
|
||||
- env: PGB_CI="--vm=co7 doc"
|
||||
- env: PGB_CI=" doc --vm=co6"
|
||||
- env: PGB_CI=" doc --vm=co7"
|
||||
|
||||
install:
|
||||
- umask 0022 && cd ~ && pwd && whoami && umask && groups
|
||||
|
@ -17,6 +17,7 @@ $SIG{__DIE__} = sub { Carp::confess @_ };
|
||||
use File::Basename qw(dirname);
|
||||
use Getopt::Long qw(GetOptions);
|
||||
use Cwd qw(abs_path);
|
||||
use Pod::Usage qw(pod2usage);
|
||||
|
||||
use lib dirname($0) . '/lib';
|
||||
use lib dirname(dirname($0)) . '/lib';
|
||||
@ -42,6 +43,8 @@ test.pl [options] doc|test
|
||||
|
||||
VM Options:
|
||||
--vm docker container to build/test
|
||||
--param parameters to pass to test.pl
|
||||
--sudo test requires sudo
|
||||
|
||||
General Options:
|
||||
--help display usage and exit
|
||||
@ -51,9 +54,13 @@ test.pl [options] doc|test
|
||||
# Command line parameters
|
||||
####################################################################################################################################
|
||||
my $strVm;
|
||||
my @stryParam;
|
||||
my $bSudo;
|
||||
my $bHelp;
|
||||
|
||||
GetOptions ('help' => \$bHelp,
|
||||
'param=s@' => \@stryParam,
|
||||
'sudo' => \$bSudo,
|
||||
'vm=s' => \$strVm)
|
||||
or pod2usage(2);
|
||||
|
||||
@ -149,6 +156,10 @@ eval
|
||||
processExec('sudo apt-get install -y texlive-font-utils latex-xcolor', {bSuppressStdErr => true});
|
||||
}
|
||||
|
||||
processBegin('remove sudo');
|
||||
processExec('sudo rm /etc/sudoers.d/travis');
|
||||
processEnd();
|
||||
|
||||
processBegin('release documentation');
|
||||
processExec("${strReleaseExe} --build --no-gen --vm=${strVm}", {bShowOutputAsync => true, bOutLogOnError => false});
|
||||
processEnd();
|
||||
@ -159,9 +170,6 @@ eval
|
||||
################################################################################################################################
|
||||
elsif ($ARGV[0] eq 'test')
|
||||
{
|
||||
my $strParam = "";
|
||||
my $strVmHost = VM_U14;
|
||||
|
||||
# Build list of packages that need to be installed
|
||||
my $strPackage = "libperl-dev";
|
||||
|
||||
@ -179,52 +187,33 @@ eval
|
||||
$strPackage .= " libdbd-pg-perl";
|
||||
}
|
||||
|
||||
processBegin('/tmp/pgbackrest owned by root so tests cannot use it');
|
||||
processExec('sudo mkdir -p /tmp/pgbackrest && sudo chown root:root /tmp/pgbackrest && sudo chmod 700 /tmp/pgbackrest');
|
||||
processEnd();
|
||||
|
||||
processBegin('install test packages');
|
||||
processExec("sudo apt-get install -y ${strPackage}", {bSuppressStdErr => true});
|
||||
processEnd();
|
||||
|
||||
# Run tests that can be run without a container
|
||||
if ($strVm eq VM_NONE)
|
||||
if (!$bSudo)
|
||||
{
|
||||
processBegin('/tmp/pgbackrest owned by root so tests cannot use it');
|
||||
processExec('sudo mkdir -p /tmp/pgbackrest && sudo chown root:root /tmp/pgbackrest && sudo chmod 700 /tmp/pgbackrest');
|
||||
processEnd();
|
||||
|
||||
# Set local timezone to make sure tests work in any timezone
|
||||
$ENV{'TZ'} = 'America/New_York';
|
||||
|
||||
processBegin('remove sudo');
|
||||
processExec('sudo rm /etc/sudoers.d/travis');
|
||||
processEnd();
|
||||
|
||||
$strVmHost = VM_U18;
|
||||
}
|
||||
# Else run tests that require a container
|
||||
else
|
||||
|
||||
# Build the container
|
||||
if ($strVm ne VM_NONE)
|
||||
{
|
||||
# Build the container
|
||||
processBegin("${strVm} build");
|
||||
processExec("${strTestExe} --vm-build --vm=${strVm}", {bShowOutputAsync => true, bOutLogOnError => false});
|
||||
processEnd();
|
||||
|
||||
# Run tests
|
||||
if ($strVm eq VM_U18)
|
||||
{
|
||||
$strParam .= " --container-only";
|
||||
}
|
||||
elsif ($strVm eq VM_F30)
|
||||
{
|
||||
$strParam .= " --no-package --c-only";
|
||||
}
|
||||
elsif ($strVm ne VM_U12)
|
||||
{
|
||||
$strParam .= " --module=real";
|
||||
}
|
||||
}
|
||||
|
||||
processBegin(($strVm eq VM_NONE ? "no container" : $strVm) . ' test');
|
||||
processExec(
|
||||
"${strTestExe} --no-gen --vm-host=${strVmHost} --vm-max=2 --vm=${strVm}${strParam}",
|
||||
"${strTestExe} --no-gen --vm-host=none --vm-max=2 --vm=${strVm}" .
|
||||
(@stryParam != 0 ? " --" . join(" --", @stryParam) : ''),
|
||||
{bShowOutputAsync => true, bOutLogOnError => false});
|
||||
processEnd();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user