1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00

Changes to allow specific tests to be run.

This commit is contained in:
David Steele 2014-06-05 10:20:03 -04:00
parent 5813aedaa3
commit c2dd53f908
2 changed files with 666 additions and 620 deletions

View File

@ -25,6 +25,15 @@ our @EXPORT = qw(BackRestFileTest);
sub BackRestFileTest
{
my $strTest = shift;
# If no test was specified, then run them all
if (!defined($strTest))
{
$strTest = 'all';
}
# Setup test paths
my $strLockPath = dirname(abs_path($0)) . "/lock";
my $strTestPath = dirname(abs_path($0)) . "/test";
my $iRun;
@ -43,6 +52,8 @@ sub BackRestFileTest
#-------------------------------------------------------------------------------------------------------------------------------
# Test path_create()
#-------------------------------------------------------------------------------------------------------------------------------
if ($strTest eq 'all' || $strTest eq 'path_create')
{
$iRun = 0;
&log(INFO, "Test File->path_create()\n");
@ -141,10 +152,13 @@ sub BackRestFileTest
}
}
}
}
#-------------------------------------------------------------------------------------------------------------------------------
# Test move()
#-------------------------------------------------------------------------------------------------------------------------------
if ($strTest eq 'all' || $strTest eq 'move')
{
$iRun = 0;
&log(INFO, "--------------------------------------------------------------------------------");
@ -228,10 +242,13 @@ sub BackRestFileTest
}
}
}
}
#-------------------------------------------------------------------------------------------------------------------------------
# Test compress()
#-------------------------------------------------------------------------------------------------------------------------------
if ($strTest eq 'all' || $strTest eq 'compress')
{
$iRun = 0;
&log(INFO, "--------------------------------------------------------------------------------");
@ -281,10 +298,13 @@ sub BackRestFileTest
}
}
}
}
#-------------------------------------------------------------------------------------------------------------------------------
# Test manifest()
#-------------------------------------------------------------------------------------------------------------------------------
if ($strTest eq 'all' || $strTest eq 'manifest')
{
$iRun = 0;
&log(INFO, "--------------------------------------------------------------------------------");
@ -411,10 +431,13 @@ sub BackRestFileTest
}
}
}
}
#-------------------------------------------------------------------------------------------------------------------------------
# Test list()
#-------------------------------------------------------------------------------------------------------------------------------
if ($strTest eq 'all' || $strTest eq 'list')
{
$iRun = 0;
&log(INFO, "--------------------------------------------------------------------------------");
@ -511,10 +534,13 @@ sub BackRestFileTest
}
}
}
}
#-------------------------------------------------------------------------------------------------------------------------------
# Test remove()
#-------------------------------------------------------------------------------------------------------------------------------
if ($strTest eq 'all' || $strTest eq 'remove')
{
$iRun = 0;
&log(INFO, "--------------------------------------------------------------------------------");
@ -583,10 +609,13 @@ sub BackRestFileTest
}
}
}
}
#-------------------------------------------------------------------------------------------------------------------------------
# Test hash()
#-------------------------------------------------------------------------------------------------------------------------------
if ($strTest eq 'all' || $strTest eq 'hash')
{
$iRun = 0;
&log(INFO, "--------------------------------------------------------------------------------");
@ -642,10 +671,13 @@ sub BackRestFileTest
}
}
}
}
#-------------------------------------------------------------------------------------------------------------------------------
# Test exists()
#-------------------------------------------------------------------------------------------------------------------------------
if ($strTest eq 'all' || $strTest eq 'exists')
{
$iRun = 0;
&log(INFO, "--------------------------------------------------------------------------------");
@ -698,12 +730,13 @@ sub BackRestFileTest
}
}
}
return;
}
#-------------------------------------------------------------------------------------------------------------------------------
# Test copy()
#-------------------------------------------------------------------------------------------------------------------------------
if ($strTest eq 'all' || $strTest eq 'copy')
{
$iRun = 0;
system("rm -rf lock");
@ -877,3 +910,4 @@ sub BackRestFileTest
}
}
}
}

View File

@ -20,9 +20,13 @@ use BackRestTest::FileTest;
####################################################################################################################################
# Command line parameters
####################################################################################################################################
my $strLogLevel = "OFF"; # Log level for tests
my $strLogLevel = 'off'; # Log level for tests
my $strModule = 'all';
my $strModuleTest = 'all';
GetOptions ("log-level=s" => \$strLogLevel)
GetOptions ("log-level=s" => \$strLogLevel,
"module=s" => \$strModule,
"module-test=s" => \$strModuleTest)
or die("Error in command line arguments\n");
####################################################################################################################################
@ -34,9 +38,17 @@ umask(0);
# Set console log level to trace for testing
log_level_set(undef, uc($strLogLevel));
if ($strModuleTest ne 'all' && $strModule eq 'all')
{
confess "--module must be provided for test \"${strModuleTest}\"";
}
####################################################################################################################################
# Runs tests
####################################################################################################################################
BackRestFileTest();
if ($strModule eq 'all' || $strModule eq "file")
{
BackRestFileTest($strModuleTest);
}
print "\nTEST COMPLETED SUCCESSFULLY (DESPITE ANY ERROR MESSAGES YOU SAW)\n";