1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-11-06 08:49:29 +02:00

Added --exe param to allow testing of packaged versions.

Updates to u12 vagrant vm.
This commit is contained in:
David Steele
2015-07-11 17:16:35 -04:00
parent e9ce4efedf
commit b777525f62
4 changed files with 33 additions and 19 deletions

View File

@@ -11,7 +11,7 @@ use strict;
use warnings FATAL => qw(all);
use Carp qw(confess);
use Cwd 'abs_path';
use Cwd qw(abs_path cwd);
use Exporter qw(import);
use File::Basename;
use File::Copy qw(move);
@@ -48,6 +48,7 @@ our @EXPORT = qw(BackRestTestCommon_Create BackRestTestCommon_Drop BackRestTestC
my $strPgSqlBin;
my $strCommonStanza;
my $strCommonCommandMain;
my $bCommandMainSet = false;
my $strCommonCommandRemote;
my $strCommonCommandRemoteFull;
my $strCommonCommandPsql;
@@ -741,6 +742,7 @@ sub BackRestTestCommon_FileRemove
####################################################################################################################################
sub BackRestTestCommon_Setup
{
my $strExe = shift;
my $strTestPathParam = shift;
my $strPgSqlBinParam = shift;
my $iModuleTestRunOnlyParam = shift;
@@ -764,7 +766,7 @@ sub BackRestTestCommon_Setup
}
else
{
$strCommonTestPath = "${strCommonBasePath}/test/test";
$strCommonTestPath = cwd() . "/test";
}
$strCommonDataPath = "${strCommonBasePath}/test/data";
@@ -774,8 +776,9 @@ sub BackRestTestCommon_Setup
$strCommonDbCommonPath = "${strCommonTestPath}/db/common";
$strCommonDbTablespacePath = "${strCommonTestPath}/db/tablespace";
$strCommonCommandMain = $strCommonBasePath . "/bin/../bin/pg_backrest";
$strCommonCommandRemote = "${strCommonBasePath}/bin/pg_backrest";
$strCommonCommandMain = defined($strExe) ? $strExe : $strCommonBasePath . "/bin/../bin/pg_backrest";
$bCommandMainSet = defined($strExe) ? true : false;
$strCommonCommandRemote = defined($strExe) ? $strExe : "${strCommonBasePath}/bin/pg_backrest";
$strCommonCommandRemoteFull = "${strCommonCommandRemote} --stanza=${strCommonStanza}" .
" --repo-remote-path=${strCommonRepoPath} --no-config remote";
$strCommonCommandPsql = "${strPgSqlBin}/psql -X %option% -h ${strCommonDbPath}";
@@ -1192,7 +1195,12 @@ sub BackRestTestCommon_CommandMainGet
sub BackRestTestCommon_CommandMainAbsGet
{
return abs_path($strCommonCommandMain);
if ($bCommandMainSet)
{
return BackRestTestCommon_CommandMainGet()
}
return abs_path(BackRestTestCommon_CommandMainGet());
}
sub BackRestTestCommon_CommandRemoteGet

View File

@@ -56,6 +56,7 @@ test.pl [options]
--log-force force overwrite of current test log files
Configuration Options:
--exe backup executable
--psql-bin path to the psql executables (e.g. /usr/lib/postgresql/9.3/bin/)
--test-path path where tests are executed (defaults to ./test)
--log-level log level to use for tests (defaults to INFO)
@@ -77,6 +78,7 @@ my $iThreadMax = 1;
my $bDryRun = false;
my $bNoCleanup = false;
my $strPgSqlBin;
my $strExe;
my $strTestPath;
my $bVersion = false;
my $bHelp = false;
@@ -89,6 +91,7 @@ GetOptions ('q|quiet' => \$bQuiet,
'version' => \$bVersion,
'help' => \$bHelp,
'pgsql-bin=s' => \$strPgSqlBin,
'exes=s' => \$strExe,
'test-path=s' => \$strTestPath,
'log-level=s' => \$strLogLevel,
'module=s' => \$strModule,
@@ -251,7 +254,8 @@ eval
{
do
{
if (BackRestTestCommon_Setup($strTestPath, $stryTestVersion[0], $iModuleTestRun, $bDryRun, $bNoCleanup, $bLogForce))
if (BackRestTestCommon_Setup($strExe, $strTestPath, $stryTestVersion[0], $iModuleTestRun,
$bDryRun, $bNoCleanup, $bLogForce))
{
&log(INFO, "TESTING psql-bin = $stryTestVersion[0]\n");

24
test/vm/Vagrantfile vendored
View File

@@ -8,20 +8,18 @@ Vagrant.configure(2) do |config|
echo 'deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main' > /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
# apt-get install -y postgresql-8.3
# pg_dropcluster --stop 8.3 main
# apt-get install -y postgresql-8.4
# pg_dropcluster --stop 8.4 main
# apt-get install -y postgresql-9.0
# pg_dropcluster --stop 9.0 main
# apt-get install -y postgresql-9.1
# pg_dropcluster --stop 9.1 main
# apt-get install -y postgresql-9.2
# pg_dropcluster --stop 9.2 main
# apt-get install -y postgresql-9.3
# pg_dropcluster --stop 9.3 main
apt-get install -y postgresql-9.4
pg_dropcluster --stop 9.4 main
apt-get install -y postgresql-9.3
pg_dropcluster --stop 9.3 main
apt-get install -y postgresql-9.2
pg_dropcluster --stop 9.2 main
apt-get install -y postgresql-9.1
pg_dropcluster --stop 9.1 main
apt-get install -y postgresql-9.0
pg_dropcluster --stop 9.0 main
apt-get install -y postgresql-8.4
pg_dropcluster --stop 8.4 main
# Setup SSH
adduser --ingroup=vagrant --disabled-password --gecos "" backrest
@@ -31,7 +29,7 @@ Vagrant.configure(2) do |config|
apt-get install -y libdbd-pg-perl
# Run the actual test
# /backrest/test/test.pl --test-path=/home/vagrant/test --db-version=all --thread-max=4
# /backrest/test/test.pl --db-version=all --thread-max=4
SHELL
end

View File

@@ -19,3 +19,7 @@ cp /backrest/test/vm/ssh/id_rsa.pub /home/backrest/.ssh/authorized_keys
chown -R backrest:vagrant /home/backrest/.ssh
chmod 700 /home/backrest/.ssh
chmod 600 /home/backrest/.ssh/*
# Clear any messages
sudo -u vagrant ssh backrest@127.0.0.1 ls
sudo -u backrest ssh backrest@127.0.0.1 ls