1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-01-30 05:39:12 +02:00

Move test definitions to test/define.yaml.

The location is better because it is no longer buried in the Perl test libs. Also, the data can be easily accessed from C.
This commit is contained in:
David Steele 2018-04-08 10:19:24 -04:00
parent b77b425096
commit 741acfd779
9 changed files with 765 additions and 943 deletions

View File

@ -19,7 +19,7 @@ env:
- PGB_CI="doc"
before_install:
- sudo apt-get -qq update && sudo apt-get install libxml-checker-perl libdbd-pg-perl libperl-critic-perl libtemplate-perl libpod-coverage-perl libtest-differences-perl libhtml-parser-perl lintian debhelper txt2man devscripts libjson-perl libio-socket-ssl-perl libxml-libxml-perl libyaml-perl python-pip lcov
- sudo apt-get -qq update && sudo apt-get install libxml-checker-perl libdbd-pg-perl libperl-critic-perl libtemplate-perl libpod-coverage-perl libtest-differences-perl libhtml-parser-perl lintian debhelper txt2man devscripts libjson-perl libio-socket-ssl-perl libxml-libxml-perl libyaml-libyaml-perl python-pip lcov
- |
# Install & Configure AWS CLI
pip install --upgrade --user awscli

View File

@ -31,8 +31,8 @@ sub errorDefineLoad
{
my $strErrorYaml = shift;
require YAML;
YAML->import(qw(Dump Load));
require YAML::XS;
YAML::XS->import(qw(Load));
$rhErrorDefine = Load($strErrorYaml);
}

View File

@ -95,6 +95,10 @@
</release-feature-list>
<release-development-list>
<release-item>
<p>Move test definitions to <file>test/define.yaml</file>. The location is better because it is no longer buried in the Perl test libs. Also, the data can be easily accessed from C.</p>
</release-item>
<release-item>
<p>Include VM type in <id>gcov</id> path to avoid conflicts between VMs with different architectures.</p>
</release-item>

2
test/Vagrantfile vendored
View File

@ -48,7 +48,7 @@ Vagrant.configure(2) do |config|
#---------------------------------------------------------------------------------------------------------------------------
echo 'Install Perl Modules' && date
apt-get install -y libdbd-pg-perl libio-socket-ssl-perl libxml-libxml-perl libxml-checker-perl libperl-critic-perl \
libdevel-nytprof-perl libyaml-perl
libdevel-nytprof-perl libyaml-libyaml-perl
#---------------------------------------------------------------------------------------------------------------------------
echo 'Install Build Tools' && date

673
test/define.yaml Normal file
View File

@ -0,0 +1,673 @@
# **********************************************************************************************************************************
# Test Definition
#
# Contains definitions for all unit and integration tests.
#
# The definitions consist of modules and tests. Modules group together tests that are related and allow common settings for all the
# tests. Every module and test must have a name. Tests must also have a total. If this total does not match the actual number of
# runs in a test then an error will be thrown.
#
# Most options can be set for modules and tests (test option will override module option if both are set):
# * db - determines if the test will be run against multiple db versions
# * container - determines if the test will be run in a container or will create containers itself
# * coverage - determines coverage for the test
# full - the module/test provides full coverage for the code module
# partial - the module/test provides partial coverage for the code module
# noCode - the code module should not contain any coverable code. If it does an error will be thrown.
# * expect - should expect log tests be run?
# * c - is this a C test (instead of Perl)?
# * cDef - defines for C testing
# * debugUnitSuppress - don't define DEBUG_UNIT for unit tests -- this is used to test unit test debugging macros
# * individual - determines if each run in a test will be run in a new container
# * perlReq - is Perl required for this C test?
#
# Some options are unique to tests:
# * total - total runs in the test
# * vm - VMs that the test will be run on
# **********************************************************************************************************************************
module:
# ********************************************************************************************************************************
- name: common
container: true
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: time
total: 2
c: true
cDef: -DNO_ERROR -DNO_LOG
coverage:
common/time: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: error
total: 6
c: true
cDef: -DNO_ERROR -DNO_LOG
coverage:
common/error: full
common/error.auto: noCode
# ----------------------------------------------------------------------------------------------------------------------------
- name: assert-on
total: 2
c: true
cDef: -DNO_LOG
coverage:
common/assert: noCode
# ----------------------------------------------------------------------------------------------------------------------------
- name: assert-off
total: 2
c: true
cDef: -DNDEBUG -DNO_LOG
debugUnitSuppress: true
coverage:
common/assert: noCode
# ----------------------------------------------------------------------------------------------------------------------------
- name: mem-context
total: 7
c: true
cDef: -DNO_MEM_CONTEXT -DNO_LOG
coverage:
common/memContext: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: log
total: 4
c: true
cDef: -DNO_LOG
coverage:
common/log: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: debug-on
total: 2
c: true
coverage:
common/debug: noCode
# ----------------------------------------------------------------------------------------------------------------------------
- name: debug-off
total: 2
c: true
cDef: -DNDEBUG -DNO_LOG
debugUnitSuppress: true
coverage:
common/debug: noCode
# ----------------------------------------------------------------------------------------------------------------------------
- name: io-handle
total: 1
c: true
coverage:
common/io/handle: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: exit
total: 1
c: true
coverage:
common/exit: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: wait
total: 1
c: true
coverage:
common/wait: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: type-list
total: 3
c: true
coverage:
common/type/list: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: type-string
total: 9
c: true
coverage:
common/type/string: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: type-string-list
total: 7
c: true
coverage:
common/type/stringList: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: type-buffer
total: 2
c: true
coverage:
common/type/buffer: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: type-variant
total: 7
c: true
coverage:
common/type/variant: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: type-variant-list
total: 3
c: true
coverage:
common/type/variantList: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: type-key-value
total: 2
c: true
coverage:
common/type/keyValue: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: encode
total: 1
c: true
coverage:
common/encode: full
common/encode/base64: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: encode-perl
total: 1
# ----------------------------------------------------------------------------------------------------------------------------
- name: http-client
total: 2
coverage:
Common/Http/Client: partial
# ----------------------------------------------------------------------------------------------------------------------------
- name: reg-exp
total: 2
c: true
coverage:
common/regExp: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: ini
total: 3
c: true
coverage:
common/ini: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: ini-perl
total: 10
coverage:
Common/Ini: partial
# ----------------------------------------------------------------------------------------------------------------------------
- name: io-handle-perl
total: 6
coverage:
Common/Io/Handle: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: io-buffered
total: 3
coverage:
Common/Io/Buffered: partial
# ----------------------------------------------------------------------------------------------------------------------------
- name: io-process
total: 3
coverage:
Common/Io/Process: partial
# ----------------------------------------------------------------------------------------------------------------------------
- name: log-perl
total: 1
coverage:
Common/Log: partial
# ********************************************************************************************************************************
- name: cipher
container: true
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: random
total: 1
c: true
coverage:
cipher/random: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: block
total: 2
c: true
coverage:
cipher/block: full
# ********************************************************************************************************************************
- name: postgres
container: true
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: page-checksum
total: 3
c: true
coverage:
postgres/pageChecksum: full
# ********************************************************************************************************************************
- name: perl
container: true
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: config
total: 1
c: true
coverage:
perl/config: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: exec
total: 2
c: true
perlReq: true
coverage:
perl/exec: full
# ********************************************************************************************************************************
- name: help
container: true
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: help
total: 4
c: true
coverage:
command/help/help: full
# ********************************************************************************************************************************
- name: config
container: true
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: define
total: 2
c: true
coverage:
config/define: full
config/define.auto: noCode
# ----------------------------------------------------------------------------------------------------------------------------
- name: config
total: 3
c: true
coverage:
config/config: full
config/config.auto: noCode
# ----------------------------------------------------------------------------------------------------------------------------
- name: parse
total: 2
c: true
coverage:
config/parse: full
config/parse.auto: noCode
# ----------------------------------------------------------------------------------------------------------------------------
- name: load
total: 1
c: true
coverage:
config/load: full
# ********************************************************************************************************************************
- name: storage
container: true
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: filter-cipher-block
total: 2
coverage:
Storage/Filter/CipherBlock: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: filter-gzip
total: 3
coverage:
Storage/Filter/Gzip: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: filter-sha
total: 2
coverage:
Storage/Filter/Sha: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: posix
total: 9
coverage:
Storage/Posix/Driver: partial
Storage/Posix/FileRead: partial
Storage/Posix/FileWrite: partial
# ----------------------------------------------------------------------------------------------------------------------------
- name: s3-auth
total: 5
coverage:
Storage/S3/Auth: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: s3-cert
total: 1
# ----------------------------------------------------------------------------------------------------------------------------
- name: s3-request
total: 2
coverage:
Storage/S3/Request: partial
# ----------------------------------------------------------------------------------------------------------------------------
- name: s3
total: 7
coverage:
Storage/S3/Driver: partial
Storage/S3/FileRead: partial
Storage/S3/FileWrite: full
vm:
- co7
- u14
- u16
- d8
# ----------------------------------------------------------------------------------------------------------------------------
- name: local
total: 10
coverage:
Storage/Local: partial
# ----------------------------------------------------------------------------------------------------------------------------
- name: helper-perl
total: 5
coverage:
Storage/Helper: partial
# ----------------------------------------------------------------------------------------------------------------------------
- name: file
total: 1
c: true
coverage:
storage/file: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: storage
total: 9
c: true
coverage:
storage/driver/posix: full
storage/storage: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: helper
total: 3
c: true
coverage:
storage/helper: full
# ********************************************************************************************************************************
- name: protocol
container: true
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: common-minion
total: 1
coverage:
Protocol/Base/Minion: partial
# ----------------------------------------------------------------------------------------------------------------------------
- name: helper
total: 2
coverage:
Protocol/Helper: partial
# ********************************************************************************************************************************
- name: info
container: true
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: unit
total: 2
coverage:
Info: full
# ********************************************************************************************************************************
- name: command
container: true
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: command
total: 1
c: true
coverage:
command/command: full
# ********************************************************************************************************************************
- name: archive
container: true
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: common
total: 4
coverage:
Archive/Common: partial
# ----------------------------------------------------------------------------------------------------------------------------
- name: push-perl
total: 8
coverage:
Archive/Push/Async: partial
Archive/Push/File: partial
Archive/Push/Push: full
Protocol/Local/Master: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: push
total: 2
c: true
perlReq: true
coverage:
command/archive/push/push: full
# ----------------------------------------------------------------------------------------------------------------------------
- name: stop
total: 7
container: false
individual: true
expect: true
# ----------------------------------------------------------------------------------------------------------------------------
- name: info-unit
total: 4
coverage:
Archive/Info: partial
# ----------------------------------------------------------------------------------------------------------------------------
- name: get
total: 2
coverage:
Archive/Base: partial
Archive/Get/Get: partial
# ********************************************************************************************************************************
- name: backup
container: true
coverage:
Backup/Common: full
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: unit
total: 3
# ----------------------------------------------------------------------------------------------------------------------------
- name: info-unit
total: 3
coverage:
Backup/Info: partial
# ********************************************************************************************************************************
- name: expire
individual: true
expect: true
coverage:
Expire: partial
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: expire
total: 4
# ********************************************************************************************************************************
- name: manifest
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: all
total: 9
container: true
coverage:
Manifest: partial
# ********************************************************************************************************************************
- name: stanza
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: all
total: 9
container: true
coverage:
Stanza: full
# ********************************************************************************************************************************
- name: mock
individual: true
expect: true
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: archive
total: 3
# ----------------------------------------------------------------------------------------------------------------------------
- name: all
total: 3
# ----------------------------------------------------------------------------------------------------------------------------
- name: stanza
total: 3
# ********************************************************************************************************************************
- name: real
expect: true
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: help
total: 1
container: true
# ----------------------------------------------------------------------------------------------------------------------------
- name: all
total: 6
individual: true
db: true
# ********************************************************************************************************************************
- name: performance
container: true
test:
# ----------------------------------------------------------------------------------------------------------------------------
- name: archive
total: 1
# ----------------------------------------------------------------------------------------------------------------------------
- name: io
total: 1

View File

@ -101,7 +101,7 @@ sub process
"before_install:\n" .
" - sudo apt-get -qq update && sudo apt-get install libxml-checker-perl libdbd-pg-perl libperl-critic-perl" .
" libtemplate-perl libpod-coverage-perl libtest-differences-perl libhtml-parser-perl lintian debhelper txt2man" .
" devscripts libjson-perl libio-socket-ssl-perl libxml-libxml-perl libyaml-perl python-pip lcov\n" .
" devscripts libjson-perl libio-socket-ssl-perl libxml-libxml-perl libyaml-libyaml-perl python-pip lcov\n" .
" - |\n" .
" # Install & Configure AWS CLI\n" .
" pip install --upgrade --user awscli\n" .

View File

@ -333,7 +333,7 @@ sub containerBuild
" yum -y install epel-release && \\\n" .
" yum -y update && \\\n" .
" yum -y install openssh-server openssh-clients wget sudo python-pip build-essential valgrind git \\\n" .
" perl perl-Digest-SHA perl-DBD-Pg perl-XML-LibXML perl-IO-Socket-SSL \\\n" .
" perl perl-Digest-SHA perl-DBD-Pg perl-XML-LibXML perl-IO-Socket-SSL perl-YAML-LibYAML \\\n" .
" gcc make perl-ExtUtils-MakeMaker perl-Test-Simple openssl-devel perl-ExtUtils-Embed";
if ($strOS eq VM_CO6)
@ -353,7 +353,8 @@ sub containerBuild
" wget --no-check-certificate -O /root/get-pip.py https://bootstrap.pypa.io/get-pip.py && \\\n" .
" python /root/get-pip.py && \\\n" .
" apt-get -y install openssh-server wget sudo python-pip build-essential valgrind git \\\n" .
" libdbd-pg-perl libhtml-parser-perl libio-socket-ssl-perl libxml-libxml-perl libssl-dev libperl-dev";
" libdbd-pg-perl libhtml-parser-perl libio-socket-ssl-perl libxml-libxml-perl libssl-dev libperl-dev \\\n" .
" libyaml-libyaml-perl";
if ($strOS eq VM_U12)
{

File diff suppressed because it is too large Load Diff

View File

@ -297,6 +297,11 @@ eval
exit 0;
}
################################################################################################################################
# Load test definition
################################################################################################################################
testDefLoad(${$oStorageBackRest->get("test/define.yaml")});
################################################################################################################################
# Start VM and run
################################################################################################################################