2016-06-24 14:12:58 +02:00
|
|
|
####################################################################################################################################
|
|
|
|
# DefineTest.pm - Defines all tests that can be run
|
|
|
|
####################################################################################################################################
|
|
|
|
package pgBackRestTest::Common::DefineTest;
|
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# Perl includes
|
|
|
|
####################################################################################################################################
|
|
|
|
use strict;
|
|
|
|
use warnings FATAL => qw(all);
|
|
|
|
use Carp qw(confess);
|
|
|
|
|
|
|
|
use Exporter qw(import);
|
|
|
|
our @EXPORT = qw();
|
|
|
|
|
|
|
|
use pgBackRest::Common::Log;
|
2017-04-10 18:31:30 +02:00
|
|
|
use pgBackRest::Common::String;
|
2016-06-24 14:12:58 +02:00
|
|
|
|
2017-06-12 16:52:32 +02:00
|
|
|
use pgBackRestTest::Common::VmTest;
|
|
|
|
|
2016-06-24 14:12:58 +02:00
|
|
|
################################################################################################################################
|
|
|
|
# Test definition constants
|
|
|
|
################################################################################################################################
|
|
|
|
use constant TESTDEF_MODULE => 'module';
|
|
|
|
push @EXPORT, qw(TESTDEF_MODULE);
|
2017-04-10 18:31:30 +02:00
|
|
|
use constant TESTDEF_NAME => 'name';
|
|
|
|
push @EXPORT, qw(TESTDEF_NAME);
|
2016-06-24 14:12:58 +02:00
|
|
|
use constant TESTDEF_TEST => 'test';
|
|
|
|
push @EXPORT, qw(TESTDEF_TEST);
|
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
# Determines if the test will be run against multiple db versions
|
|
|
|
use constant TESTDEF_DB => 'db';
|
|
|
|
push @EXPORT, qw(TESTDEF_DB);
|
|
|
|
# Determines if the test will be run in a container or will create containers itself
|
|
|
|
use constant TESTDEF_CONTAINER => 'container';
|
|
|
|
push @EXPORT, qw(TESTDEF_CONTAINER);
|
|
|
|
# Determines coverage for the test
|
|
|
|
use constant TESTDEF_COVERAGE => 'coverage';
|
|
|
|
push @EXPORT, qw(TESTDEF_COVERAGE);
|
|
|
|
# Should expect log tests be run
|
|
|
|
use constant TESTDEF_EXPECT => 'expect';
|
|
|
|
push @EXPORT, qw(TESTDEF_EXPECT);
|
2017-10-12 18:55:48 +02:00
|
|
|
# Is this a C test (instead of Perl)?
|
|
|
|
use constant TESTDEF_C => 'c';
|
|
|
|
push @EXPORT, qw(TESTDEF_C);
|
|
|
|
# Is the C library required? This only applies to unit tests, the C library is always supplied for integration tests.
|
|
|
|
use constant TESTDEF_CLIB => 'clib';
|
|
|
|
push @EXPORT, qw(TESTDEF_CLIB);
|
2017-04-10 18:31:30 +02:00
|
|
|
# Determines if each run in a test will be run in a new container
|
|
|
|
use constant TESTDEF_INDIVIDUAL => 'individual';
|
|
|
|
push @EXPORT, qw(TESTDEF_INDIVIDUAL);
|
|
|
|
# Total runs in the test
|
|
|
|
use constant TESTDEF_TOTAL => 'total';
|
|
|
|
push @EXPORT, qw(TESTDEF_TOTAL);
|
2017-06-12 16:52:32 +02:00
|
|
|
# VMs that the test can run on
|
|
|
|
use constant TESTDEF_VM => 'vm';
|
|
|
|
push @EXPORT, qw(TESTDEF_VM);
|
2017-04-10 18:31:30 +02:00
|
|
|
|
|
|
|
# The test provides full coverage for the module
|
2017-10-12 18:55:48 +02:00
|
|
|
use constant TESTDEF_COVERAGE_FULL => 'full';
|
2017-01-10 03:49:04 +02:00
|
|
|
push @EXPORT, qw(TESTDEF_COVERAGE_FULL);
|
2017-04-10 18:31:30 +02:00
|
|
|
# The test provides partial coverage for the module
|
2017-10-12 18:55:48 +02:00
|
|
|
use constant TESTDEF_COVERAGE_PARTIAL => 'partial';
|
2017-01-10 03:49:04 +02:00
|
|
|
push @EXPORT, qw(TESTDEF_COVERAGE_PARTIAL);
|
2017-10-12 18:55:48 +02:00
|
|
|
# The module does not have any code so does not have any coverage. An error will be thrown if the module has code in the future.
|
|
|
|
use constant TESTDEF_COVERAGE_NOCODE => 'nocode';
|
|
|
|
push @EXPORT, qw(TESTDEF_COVERAGE_NOCODE);
|
2017-01-10 03:49:04 +02:00
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
################################################################################################################################
|
|
|
|
# Code modules
|
|
|
|
################################################################################################################################
|
2017-04-10 19:24:45 +02:00
|
|
|
use constant TESTDEF_MODULE_COMMON => 'Common';
|
|
|
|
push @EXPORT, qw(TESTDEF_MODULE_COMMON);
|
|
|
|
use constant TESTDEF_MODULE_COMMON_INI => TESTDEF_MODULE_COMMON . '/Ini';
|
|
|
|
push @EXPORT, qw(TESTDEF_MODULE_COMMON_INI);
|
|
|
|
|
2017-02-05 17:31:29 +02:00
|
|
|
use constant TESTDEF_MODULE_INFO => 'Info';
|
|
|
|
push @EXPORT, qw(TESTDEF_MODULE_INFO);
|
|
|
|
|
2017-04-03 16:42:55 +02:00
|
|
|
use constant TESTDEF_MODULE_STANZA => 'Stanza';
|
|
|
|
push @EXPORT, qw(TESTDEF_MODULE_STANZA);
|
|
|
|
|
|
|
|
use constant TESTDEF_MODULE_EXPIRE => 'Expire';
|
|
|
|
push @EXPORT, qw(TESTDEF_MODULE_EXPIRE);
|
|
|
|
|
2016-06-24 14:12:58 +02:00
|
|
|
################################################################################################################################
|
|
|
|
# Define tests
|
|
|
|
################################################################################################################################
|
|
|
|
my $oTestDef =
|
|
|
|
{
|
|
|
|
&TESTDEF_MODULE =>
|
|
|
|
[
|
2017-05-12 22:43:04 +02:00
|
|
|
# Common tests
|
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'common',
|
|
|
|
&TESTDEF_CONTAINER => true,
|
|
|
|
|
|
|
|
&TESTDEF_TEST =>
|
|
|
|
[
|
2017-10-12 18:55:48 +02:00
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'type',
|
|
|
|
&TESTDEF_TOTAL => 2,
|
|
|
|
&TESTDEF_C => true,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'common/type' => TESTDEF_COVERAGE_NOCODE,
|
|
|
|
},
|
|
|
|
},
|
2017-10-16 16:09:56 +02:00
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'error',
|
|
|
|
&TESTDEF_TOTAL => 4,
|
|
|
|
&TESTDEF_C => true,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'common/error' => TESTDEF_COVERAGE_FULL,
|
|
|
|
'common/errorType' => TESTDEF_COVERAGE_FULL,
|
|
|
|
},
|
|
|
|
},
|
2017-10-16 17:25:49 +02:00
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'mem-context',
|
|
|
|
&TESTDEF_TOTAL => 6,
|
|
|
|
&TESTDEF_C => true,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'common/memContext' => TESTDEF_COVERAGE_FULL,
|
|
|
|
},
|
|
|
|
},
|
2017-10-18 17:14:26 +02:00
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'encode',
|
|
|
|
&TESTDEF_TOTAL => 1,
|
|
|
|
&TESTDEF_C => true,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'common/encode' => TESTDEF_COVERAGE_FULL,
|
|
|
|
'common/encode/base64' => TESTDEF_COVERAGE_FULL,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'encode-perl',
|
|
|
|
&TESTDEF_TOTAL => 1,
|
|
|
|
&TESTDEF_CLIB => true,
|
|
|
|
},
|
2017-09-01 21:07:20 +02:00
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'http-client',
|
2017-09-03 22:48:41 +02:00
|
|
|
&TESTDEF_TOTAL => 2,
|
2017-09-01 21:07:20 +02:00
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'Common/Http/Client' => TESTDEF_COVERAGE_PARTIAL,
|
|
|
|
},
|
|
|
|
},
|
2017-05-12 22:43:04 +02:00
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'ini',
|
|
|
|
&TESTDEF_TOTAL => 10,
|
2017-11-06 19:51:12 +02:00
|
|
|
&TESTDEF_CLIB => true,
|
2017-05-12 22:43:04 +02:00
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
2017-06-09 23:51:41 +02:00
|
|
|
&TESTDEF_MODULE_COMMON_INI => TESTDEF_COVERAGE_PARTIAL,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'io-handle',
|
2017-10-23 01:07:17 +02:00
|
|
|
&TESTDEF_TOTAL => 6,
|
2017-06-09 23:51:41 +02:00
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'Common/Io/Handle' => TESTDEF_COVERAGE_FULL,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'io-buffered',
|
|
|
|
&TESTDEF_TOTAL => 3,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'Common/Io/Buffered' => TESTDEF_COVERAGE_FULL,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'io-process',
|
|
|
|
&TESTDEF_TOTAL => 2,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'Common/Io/Process' => TESTDEF_COVERAGE_PARTIAL,
|
2017-05-12 22:43:04 +02:00
|
|
|
},
|
|
|
|
},
|
2017-09-01 01:15:44 +02:00
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'log',
|
|
|
|
&TESTDEF_TOTAL => 1,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'Common/Log' => TESTDEF_COVERAGE_PARTIAL,
|
|
|
|
},
|
|
|
|
},
|
2017-05-12 22:43:04 +02:00
|
|
|
]
|
|
|
|
},
|
2017-11-03 19:57:58 +02:00
|
|
|
# Cipher tests
|
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'cipher',
|
|
|
|
&TESTDEF_CONTAINER => true,
|
|
|
|
|
|
|
|
&TESTDEF_TEST =>
|
|
|
|
[
|
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'random',
|
|
|
|
&TESTDEF_TOTAL => 1,
|
|
|
|
&TESTDEF_C => true,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'cipher/random' => TESTDEF_COVERAGE_FULL,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'block',
|
|
|
|
&TESTDEF_TOTAL => 2,
|
|
|
|
&TESTDEF_C => true,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'cipher/block' => TESTDEF_COVERAGE_FULL,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
2017-10-16 17:03:06 +02:00
|
|
|
# PostgreSQL tests
|
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'postgres',
|
|
|
|
&TESTDEF_CONTAINER => true,
|
|
|
|
|
|
|
|
&TESTDEF_TEST =>
|
|
|
|
[
|
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'page-checksum',
|
|
|
|
&TESTDEF_TOTAL => 3,
|
|
|
|
&TESTDEF_C => true,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'postgres/pageChecksum' => TESTDEF_COVERAGE_FULL,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
2016-06-24 14:12:58 +02:00
|
|
|
# Help tests
|
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_NAME => 'help',
|
|
|
|
&TESTDEF_CONTAINER => true,
|
2016-12-23 15:22:59 +02:00
|
|
|
&TESTDEF_EXPECT => true,
|
2016-06-24 14:12:58 +02:00
|
|
|
|
|
|
|
&TESTDEF_TEST =>
|
|
|
|
[
|
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_NAME => 'help',
|
|
|
|
&TESTDEF_TOTAL => 1,
|
2016-06-24 14:12:58 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
# Config tests
|
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_NAME => 'config',
|
|
|
|
&TESTDEF_CONTAINER => true,
|
2016-06-24 14:12:58 +02:00
|
|
|
|
|
|
|
&TESTDEF_TEST =>
|
|
|
|
[
|
2017-10-16 17:13:51 +02:00
|
|
|
{
|
2017-11-02 14:14:13 +02:00
|
|
|
&TESTDEF_NAME => 'define',
|
|
|
|
&TESTDEF_TOTAL => 1,
|
|
|
|
&TESTDEF_C => true,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'config/define' => TESTDEF_COVERAGE_FULL,
|
|
|
|
'config/define.auto' => TESTDEF_COVERAGE_NOCODE,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'config',
|
|
|
|
&TESTDEF_TOTAL => 1,
|
2017-10-16 17:13:51 +02:00
|
|
|
&TESTDEF_C => true,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
2017-11-02 14:14:13 +02:00
|
|
|
'config/config' => TESTDEF_COVERAGE_FULL,
|
|
|
|
'config/config.auto' => TESTDEF_COVERAGE_NOCODE,
|
2017-10-16 17:13:51 +02:00
|
|
|
},
|
|
|
|
},
|
2017-03-23 01:03:28 +02:00
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_NAME => 'unit',
|
2017-05-16 17:28:51 +02:00
|
|
|
&TESTDEF_TOTAL => 1,
|
2017-03-23 01:03:28 +02:00
|
|
|
},
|
2016-06-24 14:12:58 +02:00
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_NAME => 'option',
|
|
|
|
&TESTDEF_TOTAL => 34,
|
2016-06-24 14:12:58 +02:00
|
|
|
},
|
|
|
|
{
|
2017-11-02 14:14:13 +02:00
|
|
|
&TESTDEF_NAME => 'config-perl',
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_TOTAL => 25,
|
2016-06-24 14:12:58 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-06-09 23:51:41 +02:00
|
|
|
# Storage tests
|
2016-06-24 14:12:58 +02:00
|
|
|
{
|
2017-06-09 23:51:41 +02:00
|
|
|
&TESTDEF_NAME => 'storage',
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_CONTAINER => true,
|
2016-06-24 14:12:58 +02:00
|
|
|
|
|
|
|
&TESTDEF_TEST =>
|
|
|
|
[
|
2017-11-03 19:57:58 +02:00
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'filter-cipher-block',
|
|
|
|
&TESTDEF_TOTAL => 2,
|
|
|
|
&TESTDEF_CLIB => true,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'Storage/Filter/CipherBlock' => TESTDEF_COVERAGE_FULL,
|
|
|
|
},
|
|
|
|
},
|
2016-12-23 15:30:34 +02:00
|
|
|
{
|
2017-06-09 23:51:41 +02:00
|
|
|
&TESTDEF_NAME => 'filter-gzip',
|
|
|
|
&TESTDEF_TOTAL => 3,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
2017-11-14 22:12:31 +02:00
|
|
|
'Storage/Filter/Gzip' => TESTDEF_COVERAGE_FULL,
|
2017-06-09 23:51:41 +02:00
|
|
|
},
|
2016-06-24 14:12:58 +02:00
|
|
|
},
|
|
|
|
{
|
2017-06-09 23:51:41 +02:00
|
|
|
&TESTDEF_NAME => 'filter-sha',
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_TOTAL => 2,
|
2017-06-09 23:51:41 +02:00
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'Storage/Filter/Sha' => TESTDEF_COVERAGE_FULL,
|
|
|
|
},
|
2016-06-24 14:12:58 +02:00
|
|
|
},
|
2017-02-14 02:59:14 +02:00
|
|
|
{
|
2017-06-09 23:51:41 +02:00
|
|
|
&TESTDEF_NAME => 'posix',
|
|
|
|
&TESTDEF_TOTAL => 9,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'Storage/Posix/Driver' => TESTDEF_COVERAGE_PARTIAL,
|
|
|
|
'Storage/Posix/FileRead' => TESTDEF_COVERAGE_PARTIAL,
|
|
|
|
'Storage/Posix/FileWrite' => TESTDEF_COVERAGE_PARTIAL,
|
|
|
|
},
|
2016-06-24 14:12:58 +02:00
|
|
|
},
|
2017-06-12 16:52:32 +02:00
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 's3-auth',
|
|
|
|
&TESTDEF_TOTAL => 5,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'Storage/S3/Auth' => TESTDEF_COVERAGE_FULL,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2017-06-23 00:22:49 +02:00
|
|
|
&TESTDEF_NAME => 's3-cert',
|
|
|
|
&TESTDEF_TOTAL => 1,
|
|
|
|
},
|
2017-08-08 23:15:01 +02:00
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 's3-request',
|
|
|
|
&TESTDEF_TOTAL => 2,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'Storage/S3/Request' => TESTDEF_COVERAGE_PARTIAL,
|
|
|
|
},
|
|
|
|
},
|
2017-06-23 00:22:49 +02:00
|
|
|
{
|
2017-06-12 16:52:32 +02:00
|
|
|
&TESTDEF_NAME => 's3',
|
|
|
|
&TESTDEF_TOTAL => 7,
|
2017-06-24 16:59:00 +02:00
|
|
|
&TESTDEF_VM => [VM_CO7, VM_U14, VM_U16, VM_D8],
|
2017-06-12 16:52:32 +02:00
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'Storage/S3/Driver' => TESTDEF_COVERAGE_PARTIAL,
|
|
|
|
'Storage/S3/FileRead' => TESTDEF_COVERAGE_PARTIAL,
|
|
|
|
'Storage/S3/FileWrite' => TESTDEF_COVERAGE_FULL,
|
|
|
|
},
|
|
|
|
},
|
2016-06-24 14:12:58 +02:00
|
|
|
{
|
2017-06-09 23:51:41 +02:00
|
|
|
&TESTDEF_NAME => 'local',
|
2017-11-06 19:51:12 +02:00
|
|
|
&TESTDEF_TOTAL => 10,
|
2017-10-12 18:55:48 +02:00
|
|
|
&TESTDEF_CLIB => true,
|
2017-06-09 23:51:41 +02:00
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'Storage/Local' => TESTDEF_COVERAGE_PARTIAL,
|
|
|
|
},
|
2016-06-24 14:12:58 +02:00
|
|
|
},
|
|
|
|
{
|
2017-06-09 23:51:41 +02:00
|
|
|
&TESTDEF_NAME => 'helper',
|
2017-11-06 19:51:12 +02:00
|
|
|
&TESTDEF_TOTAL => 5,
|
|
|
|
&TESTDEF_CLIB => true,
|
2017-06-09 23:51:41 +02:00
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'Storage/Helper' => TESTDEF_COVERAGE_PARTIAL,
|
|
|
|
},
|
2016-06-24 14:12:58 +02:00
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
2017-06-09 23:51:41 +02:00
|
|
|
# Protocol tests
|
2017-04-10 18:31:30 +02:00
|
|
|
{
|
2017-06-09 23:51:41 +02:00
|
|
|
&TESTDEF_NAME => 'protocol',
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_CONTAINER => true,
|
|
|
|
|
|
|
|
&TESTDEF_TEST =>
|
|
|
|
[
|
|
|
|
{
|
2017-06-09 23:51:41 +02:00
|
|
|
&TESTDEF_NAME => 'common-minion',
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_TOTAL => 1,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
2017-06-09 23:51:41 +02:00
|
|
|
'Protocol/Base/Minion' => TESTDEF_COVERAGE_PARTIAL,
|
2017-04-10 18:31:30 +02:00
|
|
|
},
|
|
|
|
},
|
2017-08-01 16:34:53 +02:00
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'helper',
|
|
|
|
&TESTDEF_TOTAL => 1,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'Protocol/Helper' => TESTDEF_COVERAGE_PARTIAL,
|
|
|
|
},
|
|
|
|
},
|
2017-04-10 18:31:30 +02:00
|
|
|
]
|
|
|
|
},
|
2017-06-09 23:51:41 +02:00
|
|
|
# Info tests
|
2016-06-24 14:12:58 +02:00
|
|
|
{
|
2017-06-09 23:51:41 +02:00
|
|
|
&TESTDEF_NAME => 'info',
|
|
|
|
&TESTDEF_CONTAINER => true,
|
2017-04-03 16:42:55 +02:00
|
|
|
|
2016-06-24 14:12:58 +02:00
|
|
|
&TESTDEF_TEST =>
|
|
|
|
[
|
2017-04-03 16:42:55 +02:00
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_NAME => 'unit',
|
2017-11-06 19:51:12 +02:00
|
|
|
&TESTDEF_TOTAL => 2,
|
|
|
|
&TESTDEF_CLIB => true,
|
2017-06-09 23:51:41 +02:00
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
2017-07-21 23:32:41 +02:00
|
|
|
&TESTDEF_MODULE_INFO => TESTDEF_COVERAGE_FULL,
|
2017-06-09 23:51:41 +02:00
|
|
|
},
|
2017-04-03 16:42:55 +02:00
|
|
|
},
|
2017-01-05 01:31:16 +02:00
|
|
|
]
|
|
|
|
},
|
|
|
|
# Archive tests
|
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_NAME => 'archive',
|
2017-11-06 19:51:12 +02:00
|
|
|
&TESTDEF_CONTAINER => true,
|
2017-01-05 01:31:16 +02:00
|
|
|
|
|
|
|
&TESTDEF_TEST =>
|
|
|
|
[
|
2017-01-05 01:39:50 +02:00
|
|
|
{
|
2017-06-21 14:02:21 +02:00
|
|
|
&TESTDEF_NAME => 'common',
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_TOTAL => 4,
|
2017-01-27 18:02:27 +02:00
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_COVERAGE =>
|
2017-01-27 18:02:27 +02:00
|
|
|
{
|
2017-06-21 14:02:21 +02:00
|
|
|
'Archive/Common' => TESTDEF_COVERAGE_PARTIAL,
|
2017-01-27 18:02:27 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2017-06-21 14:45:58 +02:00
|
|
|
&TESTDEF_NAME => 'push',
|
2017-11-06 19:51:12 +02:00
|
|
|
&TESTDEF_TOTAL => 8,
|
|
|
|
&TESTDEF_CLIB => true,
|
2017-01-27 18:02:27 +02:00
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_COVERAGE =>
|
2017-01-27 18:02:27 +02:00
|
|
|
{
|
2017-06-21 14:02:21 +02:00
|
|
|
'Archive/Push/Push' => TESTDEF_COVERAGE_FULL,
|
|
|
|
'Archive/Push/Async' => TESTDEF_COVERAGE_FULL,
|
|
|
|
'Archive/Push/File' => TESTDEF_COVERAGE_FULL,
|
2017-08-30 14:41:46 +02:00
|
|
|
'Protocol/Local/Master' => TESTDEF_COVERAGE_FULL,
|
|
|
|
'Protocol/Local/Minion' => TESTDEF_COVERAGE_PARTIAL,
|
2017-01-27 18:02:27 +02:00
|
|
|
},
|
2017-01-05 01:39:50 +02:00
|
|
|
},
|
2016-06-24 14:12:58 +02:00
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_NAME => 'stop',
|
2017-06-12 16:52:32 +02:00
|
|
|
&TESTDEF_TOTAL => 7,
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_INDIVIDUAL => true,
|
|
|
|
&TESTDEF_EXPECT => true,
|
2017-11-06 19:51:12 +02:00
|
|
|
&TESTDEF_CONTAINER => false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'info-unit',
|
2017-11-17 00:18:51 +02:00
|
|
|
&TESTDEF_TOTAL => 4,
|
2017-11-06 19:51:12 +02:00
|
|
|
&TESTDEF_CLIB => true,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'Archive/Info' => TESTDEF_COVERAGE_PARTIAL,
|
|
|
|
},
|
2016-06-24 14:12:58 +02:00
|
|
|
},
|
2017-11-17 00:18:51 +02:00
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'get',
|
|
|
|
&TESTDEF_TOTAL => 2,
|
|
|
|
&TESTDEF_CLIB => true,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'Archive/Base' => TESTDEF_COVERAGE_PARTIAL,
|
|
|
|
'Archive/Get/Get' => TESTDEF_COVERAGE_PARTIAL,
|
|
|
|
},
|
|
|
|
},
|
2017-01-05 01:31:16 +02:00
|
|
|
]
|
|
|
|
},
|
|
|
|
# Backup tests
|
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_NAME => 'backup',
|
|
|
|
&TESTDEF_CONTAINER => true,
|
2017-01-05 01:31:16 +02:00
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_COVERAGE =>
|
2017-04-05 16:16:16 +02:00
|
|
|
{
|
2017-05-15 22:01:00 +02:00
|
|
|
'Backup/Common' => TESTDEF_COVERAGE_FULL,
|
2017-04-05 16:16:16 +02:00
|
|
|
},
|
|
|
|
|
2017-01-05 01:31:16 +02:00
|
|
|
&TESTDEF_TEST =>
|
|
|
|
[
|
2016-06-24 14:12:58 +02:00
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_NAME => 'unit',
|
|
|
|
&TESTDEF_TOTAL => 3,
|
2016-06-24 14:12:58 +02:00
|
|
|
},
|
2017-04-07 01:36:37 +02:00
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_NAME => 'info-unit',
|
2017-11-06 19:51:12 +02:00
|
|
|
&TESTDEF_TOTAL => 3,
|
|
|
|
&TESTDEF_CLIB => true,
|
|
|
|
|
2017-08-04 22:03:55 +02:00
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
'Backup/Info' => TESTDEF_COVERAGE_PARTIAL,
|
|
|
|
},
|
2017-04-07 01:36:37 +02:00
|
|
|
},
|
2017-01-05 01:31:16 +02:00
|
|
|
]
|
|
|
|
},
|
|
|
|
# Expire tests
|
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_NAME => 'expire',
|
2017-01-05 01:31:16 +02:00
|
|
|
&TESTDEF_EXPECT => true,
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_INDIVIDUAL => true,
|
2017-01-05 01:31:16 +02:00
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_COVERAGE =>
|
2017-04-03 16:42:55 +02:00
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_MODULE_EXPIRE => TESTDEF_COVERAGE_PARTIAL,
|
2017-04-03 16:42:55 +02:00
|
|
|
},
|
|
|
|
|
2017-01-05 01:31:16 +02:00
|
|
|
&TESTDEF_TEST =>
|
|
|
|
[
|
2016-12-20 23:52:20 +02:00
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_NAME => 'expire',
|
2017-11-06 19:51:12 +02:00
|
|
|
&TESTDEF_TOTAL => 4,
|
2017-02-05 17:31:29 +02:00
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
2017-06-09 23:51:41 +02:00
|
|
|
# Stanza tests
|
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'stanza',
|
|
|
|
|
|
|
|
&TESTDEF_TEST =>
|
|
|
|
[
|
|
|
|
{
|
2017-08-04 22:10:51 +02:00
|
|
|
&TESTDEF_NAME => 'all',
|
2017-11-06 19:51:12 +02:00
|
|
|
&TESTDEF_TOTAL => 8,
|
|
|
|
&TESTDEF_CLIB => true,
|
2017-06-09 23:51:41 +02:00
|
|
|
&TESTDEF_CONTAINER => true,
|
|
|
|
|
|
|
|
&TESTDEF_COVERAGE =>
|
|
|
|
{
|
|
|
|
&TESTDEF_MODULE_STANZA => TESTDEF_COVERAGE_FULL,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
2017-06-20 00:55:00 +02:00
|
|
|
# Mock tests
|
2017-01-05 01:31:16 +02:00
|
|
|
{
|
2017-06-20 00:55:00 +02:00
|
|
|
&TESTDEF_NAME => 'mock',
|
2017-01-05 01:31:16 +02:00
|
|
|
&TESTDEF_EXPECT => true,
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_INDIVIDUAL => true,
|
2017-01-05 01:31:16 +02:00
|
|
|
|
|
|
|
&TESTDEF_TEST =>
|
|
|
|
[
|
2017-06-21 14:38:53 +02:00
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'archive',
|
|
|
|
&TESTDEF_TOTAL => 3,
|
|
|
|
},
|
2016-06-24 14:12:58 +02:00
|
|
|
{
|
2017-06-20 00:55:00 +02:00
|
|
|
&TESTDEF_NAME => 'all',
|
2017-06-15 21:32:10 +02:00
|
|
|
&TESTDEF_TOTAL => 3,
|
2016-06-24 14:12:58 +02:00
|
|
|
},
|
2017-08-04 22:10:51 +02:00
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'stanza',
|
|
|
|
&TESTDEF_TOTAL => 3,
|
|
|
|
},
|
2017-06-20 00:55:00 +02:00
|
|
|
]
|
|
|
|
},
|
|
|
|
# Real tests
|
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'real',
|
|
|
|
&TESTDEF_EXPECT => true,
|
|
|
|
&TESTDEF_INDIVIDUAL => true,
|
|
|
|
|
|
|
|
&TESTDEF_TEST =>
|
|
|
|
[
|
2016-06-24 14:12:58 +02:00
|
|
|
{
|
2017-06-20 00:55:00 +02:00
|
|
|
&TESTDEF_NAME => 'all',
|
2017-06-21 22:07:13 +02:00
|
|
|
&TESTDEF_TOTAL => 6,
|
2017-04-10 18:31:30 +02:00
|
|
|
&TESTDEF_DB => true,
|
2016-06-24 14:12:58 +02:00
|
|
|
}
|
|
|
|
]
|
2017-06-28 00:00:39 +02:00
|
|
|
},
|
|
|
|
# Performance tests
|
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'performance',
|
2017-10-22 19:27:47 +02:00
|
|
|
&TESTDEF_CONTAINER => true,
|
2017-06-28 00:00:39 +02:00
|
|
|
|
|
|
|
&TESTDEF_TEST =>
|
|
|
|
[
|
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'archive',
|
|
|
|
&TESTDEF_TOTAL => 1,
|
|
|
|
},
|
2017-10-22 19:27:47 +02:00
|
|
|
{
|
|
|
|
&TESTDEF_NAME => 'io',
|
|
|
|
&TESTDEF_TOTAL => 1,
|
|
|
|
},
|
2017-06-28 00:00:39 +02:00
|
|
|
]
|
2017-01-05 01:31:16 +02:00
|
|
|
},
|
2016-06-24 14:12:58 +02:00
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
####################################################################################################################################
|
2017-04-10 18:31:30 +02:00
|
|
|
# Process normalized data into a more queryable form
|
|
|
|
####################################################################################################################################
|
|
|
|
my $hTestDefHash; # An easier way to query hash version of the above
|
|
|
|
my @stryModule; # Ordered list of modules
|
|
|
|
my $hModuleTest; # Ordered list of tests for each module
|
|
|
|
my $hCoverageType; # Coverage type for each code module (full/partial)
|
|
|
|
my $hCoverageList; # Tests required for full code module coverage (if type full)
|
|
|
|
|
|
|
|
# Iterate each module
|
|
|
|
foreach my $hModule (@{$oTestDef->{&TESTDEF_MODULE}})
|
|
|
|
{
|
|
|
|
# Push the module onto the ordered list
|
|
|
|
my $strModule = $hModule->{&TESTDEF_NAME};
|
|
|
|
push(@stryModule, $strModule);
|
|
|
|
|
|
|
|
# Iterate each test
|
|
|
|
my @stryModuleTest;
|
|
|
|
|
|
|
|
foreach my $hModuleTest (@{$hModule->{&TESTDEF_TEST}})
|
|
|
|
{
|
|
|
|
# Push the test on the order list
|
|
|
|
my $strTest = $hModuleTest->{&TESTDEF_NAME};
|
|
|
|
push(@stryModuleTest, $strTest);
|
|
|
|
|
|
|
|
# Resolve variables that can be set in the module or the test
|
|
|
|
foreach my $strVar (
|
2017-10-12 18:55:48 +02:00
|
|
|
TESTDEF_C, TESTDEF_CLIB, TESTDEF_CONTAINER, TESTDEF_EXPECT, TESTDEF_DB, TESTDEF_INDIVIDUAL, TESTDEF_VM)
|
2017-04-10 18:31:30 +02:00
|
|
|
{
|
|
|
|
$hTestDefHash->{$strModule}{$strTest}{$strVar} = coalesce(
|
2017-06-12 16:52:32 +02:00
|
|
|
$hModuleTest->{$strVar}, $hModule->{$strVar}, $strVar eq TESTDEF_VM ? undef : false);
|
2017-04-10 18:31:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Set test count
|
|
|
|
$hTestDefHash->{$strModule}{$strTest}{&TESTDEF_TOTAL} = $hModuleTest->{&TESTDEF_TOTAL};
|
|
|
|
|
2017-10-12 18:55:48 +02:00
|
|
|
# If this is a C test then add the test module to coverage
|
|
|
|
if ($hModuleTest->{&TESTDEF_C})
|
|
|
|
{
|
|
|
|
my $strTestFile = "module/${strModule}/${strTest}Test";
|
|
|
|
|
|
|
|
$hModuleTest->{&TESTDEF_COVERAGE}{$strTestFile} = TESTDEF_COVERAGE_FULL;
|
|
|
|
}
|
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
# Concatenate coverage for modules and tests
|
|
|
|
foreach my $hCoverage ($hModule->{&TESTDEF_COVERAGE}, $hModuleTest->{&TESTDEF_COVERAGE})
|
|
|
|
{
|
|
|
|
foreach my $strCodeModule (sort(keys(%{$hCoverage})))
|
|
|
|
{
|
|
|
|
if (defined($hTestDefHash->{$strModule}{$strTest}{&TESTDEF_COVERAGE}{$strCodeModule}))
|
|
|
|
{
|
|
|
|
confess &log(ASSERT,
|
|
|
|
"${strCodeModule} is defined for coverage in both module ${strModule} and test ${strTest}");
|
|
|
|
}
|
|
|
|
|
|
|
|
$hTestDefHash->{$strModule}{$strTest}{&TESTDEF_COVERAGE}{$strCodeModule} = $hCoverage->{$strCodeModule};
|
|
|
|
|
|
|
|
# Build coverage type hash and make sure coverage type does not change
|
|
|
|
if (!defined($hCoverageType->{$strCodeModule}))
|
|
|
|
{
|
|
|
|
$hCoverageType->{$strCodeModule} = $hCoverage->{$strCodeModule};
|
|
|
|
}
|
2017-10-12 18:55:48 +02:00
|
|
|
elsif ($hCoverageType->{$strCodeModule} ne $hCoverage->{$strCodeModule})
|
2017-04-10 18:31:30 +02:00
|
|
|
{
|
2017-10-12 18:55:48 +02:00
|
|
|
confess &log(ASSERT, "cannot mix coverage types for ${strCodeModule}");
|
2017-04-10 18:31:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Add to coverage list
|
|
|
|
push(@{$hCoverageList->{$strCodeModule}}, {strModule=> $strModule, strTest => $strTest});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$hModuleTest->{$strModule} = \@stryModuleTest;
|
|
|
|
}
|
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# testDefModuleList
|
2016-06-24 14:12:58 +02:00
|
|
|
####################################################################################################################################
|
2017-04-10 18:31:30 +02:00
|
|
|
sub testDefModuleList
|
2016-06-24 14:12:58 +02:00
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
return @stryModule;
|
2016-06-24 14:12:58 +02:00
|
|
|
}
|
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
push @EXPORT, qw(testDefModuleList);
|
2016-06-24 14:12:58 +02:00
|
|
|
|
2016-12-23 15:22:59 +02:00
|
|
|
####################################################################################################################################
|
2017-04-10 18:31:30 +02:00
|
|
|
# testDefModule
|
2016-12-23 15:22:59 +02:00
|
|
|
####################################################################################################################################
|
2017-04-10 18:31:30 +02:00
|
|
|
sub testDefModule
|
2016-12-23 15:22:59 +02:00
|
|
|
{
|
|
|
|
my $strModule = shift;
|
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
if (!defined($hTestDefHash->{$strModule}))
|
2016-12-23 15:22:59 +02:00
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
confess &log(ASSERT, "unable to find module ${strModule}");
|
|
|
|
}
|
|
|
|
|
|
|
|
return $hTestDefHash->{$strModule};
|
|
|
|
}
|
|
|
|
|
|
|
|
push @EXPORT, qw(testDefModule);
|
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# testDefModuleTestList
|
|
|
|
####################################################################################################################################
|
|
|
|
sub testDefModuleTestList
|
|
|
|
{
|
|
|
|
my $strModule = shift;
|
|
|
|
|
|
|
|
if (!defined($hModuleTest->{$strModule}))
|
|
|
|
{
|
|
|
|
confess &log(ASSERT, "unable to find module ${strModule}");
|
2016-12-23 15:22:59 +02:00
|
|
|
}
|
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
return @{$hModuleTest->{$strModule}};
|
2016-12-23 15:22:59 +02:00
|
|
|
}
|
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
push @EXPORT, qw(testDefModuleTestList);
|
2016-12-23 15:22:59 +02:00
|
|
|
|
|
|
|
####################################################################################################################################
|
2017-04-10 18:31:30 +02:00
|
|
|
# testDefModuleTest
|
2016-12-23 15:22:59 +02:00
|
|
|
####################################################################################################################################
|
2017-04-10 18:31:30 +02:00
|
|
|
sub testDefModuleTest
|
2016-12-23 15:22:59 +02:00
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
my $strModule = shift;
|
2016-12-23 15:22:59 +02:00
|
|
|
my $strModuleTest = shift;
|
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
if (!defined($hTestDefHash->{$strModule}{$strModuleTest}))
|
2016-12-23 15:22:59 +02:00
|
|
|
{
|
2017-04-10 18:31:30 +02:00
|
|
|
confess &log(ASSERT, "unable to find module ${strModule}, test ${strModuleTest}");
|
2016-12-23 15:22:59 +02:00
|
|
|
}
|
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
return $hTestDefHash->{$strModule}{$strModuleTest};
|
|
|
|
}
|
|
|
|
|
|
|
|
push @EXPORT, qw(testDefModuleTest);
|
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# testDefCoverageType
|
|
|
|
####################################################################################################################################
|
|
|
|
sub testDefCoverageType
|
|
|
|
{
|
|
|
|
return $hCoverageType;
|
|
|
|
}
|
|
|
|
|
|
|
|
push @EXPORT, qw(testDefCoverageType);
|
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# testDefCoverageList
|
|
|
|
####################################################################################################################################
|
|
|
|
sub testDefCoverageList
|
|
|
|
{
|
|
|
|
return $hCoverageList;
|
2016-12-23 15:22:59 +02:00
|
|
|
}
|
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
push @EXPORT, qw(testDefCoverageList);
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2016-06-24 14:12:58 +02:00
|
|
|
1;
|