1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-09-16 09:06:18 +02:00

Update primary test environment (Vagrant and Docker) to Ubuntu 18.04.

This commit is contained in:
David Steele
2018-06-06 15:52:28 -04:00
parent d309a85b51
commit a385cb520b
19 changed files with 95 additions and 53 deletions

View File

@@ -12,14 +12,14 @@ services:
- docker
env:
- PGB_CI="--vm=u16 test"
- PGB_CI="--vm=u18 test"
- PGB_CI="--vm=co6 test"
- PGB_CI="--vm=co7 test"
- PGB_CI="--vm=u12 test"
- 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-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 libjson-maybexs-perl
- |
# Install & Configure AWS CLI
pip install --upgrade --user awscli
@@ -30,7 +30,8 @@ before_install:
aws configure list
- |
# Install Devel::Cover
sudo dpkg -i ${TRAVIS_BUILD_DIR?}/test/package/u14-libdevel-cover-perl_1.23-2_amd64.deb
sudo dpkg -i ${TRAVIS_BUILD_DIR?}/test/package/u14-libdevel-cover-perl_1.29-2_amd64.deb
sudo apt-get -f install
/usr/bin/cover -v
install:

View File

@@ -41,6 +41,10 @@
<release-test-list>
<release-development-list>
<release-item>
<p>Update primary test environment (Vagrant and Docker) to Ubuntu 18.04.</p>
</release-item>
<release-item>
<p>Improve efficiency of C library builds now that they are used only for testing.</p>
</release-item>

View File

@@ -830,7 +830,8 @@ sub test
# Is there a value to test against?
if (defined($strTest))
{
return $strResult eq $strTest ? true : false;
# Make sure these are explicit strings or Devel::Cover thinks they are equal if one side is a boolean
return ($strResult . '') eq ($strTest . '') ? true : false;
}
return true;

View File

@@ -105,6 +105,10 @@ bufCat(Buffer *this, const Buffer *cat)
size_t sizeOld = this->size;
bufResize(this, sizeOld + cat->size);
// Just here to silence nonnull warnings from clang static analyzer
ASSERT_DEBUG(this->buffer != NULL);
memcpy(this->buffer + sizeOld, cat->buffer, cat->size);
}

View File

@@ -449,8 +449,8 @@ cfgOptionDefault(ConfigOption optionId)
configOptionValue[optionId].defaultValue = varDup(defaultValue);
break;
default:
THROW_FMT( // {uncoverable - others types do not have defaults yet}
default: // {uncoverable - other types do not have defaults yet}
THROW_FMT( // {+uncoverable}
AssertError, "type for option '%s' does not support defaults", cfgOptionName(optionId));
}
}

View File

@@ -149,8 +149,8 @@ convertToByte(String **value, double *valueDbl)
multiplier = 1024LL * 1024LL * 1024LL * 1024LL * 1024LL;
break;
default:
THROW_FMT( // {uncoverable - regex covers all cases but default required}
default: // {uncoverable - regex covers all cases but default required}
THROW_FMT( // {+uncoverable}
AssertError, "character %c is not a valid type", strArray[chrPos]);
}
}
@@ -830,13 +830,13 @@ configParse(unsigned int argListSize, const char *argList[])
}
// Other types are output plain
case cfgDefOptTypeFloat:
case cfgDefOptTypeFloat: // {uncovered - no depends of other types}
case cfgDefOptTypeHash:
case cfgDefOptTypeInteger:
case cfgDefOptTypeList:
case cfgDefOptTypeSize:
{
strLstAddZ(dependValueList, dependValue); // {uncovered - no depends of other types}
strLstAddZ(dependValueList, dependValue); // {+uncovered}
break; // {+uncovered}
}
}

View File

@@ -7266,7 +7266,8 @@ static const EmbeddedModule embeddedModule[] =
"\n"
"if (defined($strTest))\n"
"{\n"
"return $strResult eq $strTest ? true : false;\n"
"\n"
"return ($strResult . '') eq ($strTest . '') ? true : false;\n"
"}\n"
"\n"
"return true;\n"

View File

@@ -1,5 +1,5 @@
/*
* This file was generated automatically by ExtUtils::ParseXS version 3.28 from the
* This file was generated automatically by ExtUtils::ParseXS version 3.34 from the
* contents of LibC.xs. Do not edit this file, edit LibC.xs instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
@@ -200,7 +200,7 @@ S_croak_xs_usage(const CV *const cv, const char *const params)
Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
} else {
/* Pants. I don't think that it should be possible to get here. */
Perl_croak_nocontext("Usage: CODE(0x%"UVxf")(%s)", PTR2UV(cv), params);
Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
}
}
#undef PERL_ARGS_ASSERT_CROAK_XS_USAGE

2
test/.gitignore vendored
View File

@@ -2,5 +2,5 @@
nytprof*
scratch.txt
coverage*
ubuntu-xenial-16.04-cloudimg-console.log
ubuntu-bionic-18.04-cloudimg-console.log
profile

12
test/Vagrantfile vendored
View File

@@ -4,8 +4,8 @@ Vagrant.configure(2) do |config|
vb.cpus = 8
end
config.vm.box = "ubuntu/xenial64"
config.vm.box_version = "20180126.0.0"
config.vm.box = "ubuntu/bionic64"
config.vm.box_version = "20180531.0.0"
# vagrant plugin install vagrant-disksize
# config.disksize.size = '64GB'
@@ -73,15 +73,11 @@ Vagrant.configure(2) do |config|
#---------------------------------------------------------------------------------------------------------------------------
echo 'Install Devel::Cover' && date
dpkg -i /backrest/test/package/u16-libdevel-cover-perl_1.23-2_amd64.deb
dpkg -i /backrest/test/package/u18-libdevel-cover-perl_1.29-2_amd64.deb
#---------------------------------------------------------------------------------------------------------------------------
echo 'Install Docker' && date
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update
apt-get install -y docker-ce
curl -fsSL test.docker.com | sh
sudo usermod -aG docker vagrant
#---------------------------------------------------------------------------------------------------------------------------

View File

@@ -433,6 +433,7 @@ unit:
- co7
- u14
- u16
- u18
- d8
# ----------------------------------------------------------------------------------------------------------------------------

View File

@@ -101,7 +101,8 @@ 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-libyaml-perl python-pip lcov\n" .
" devscripts libjson-perl libio-socket-ssl-perl libxml-libxml-perl libyaml-libyaml-perl python-pip lcov" .
" libjson-maybexs-perl\n" .
" - |\n" .
" # Install & Configure AWS CLI\n" .
" pip install --upgrade --user awscli\n" .
@@ -113,6 +114,7 @@ sub process
" - |\n" .
" # Install Devel::Cover\n" .
" sudo dpkg -i \${TRAVIS_BUILD_DIR?}/test/package/u14-" . packageDevelCover(VM_ARCH_AMD64) . "\n" .
" sudo apt-get -f install\n" .
' ' . LIB_COVER_EXE . " -v\n" .
"\n" .
"install:\n" .

View File

@@ -48,7 +48,7 @@ use constant BACKREST_USER_ID => getpwnam(
####################################################################################################################################
# Package constants
####################################################################################################################################
use constant LIB_COVER_VERSION => '1.23-2';
use constant LIB_COVER_VERSION => '1.29-2';
push @EXPORT, qw(LIB_COVER_VERSION);
use constant LIB_COVER_EXE => '/usr/bin/cover';
push @EXPORT, qw(LIB_COVER_EXE);
@@ -214,7 +214,8 @@ sub certSetup
" openssl req -new -key server.key -out server.csr \\\n" .
" -subj \"/C=US/ST=Country/L=City/O=Organization/CN=*.pgbackrest.org\" && \\\n" .
" openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 99999 \\\n" .
" -sha256";
" -sha256 && \\\n" .
" chmod 644 /etc/fake-cert/*";
}
####################################################################################################################################
@@ -241,6 +242,11 @@ sub s3ServerSetup
" wget -O /root/nodejs.sh https://deb.nodesource.com/setup_6.x && \\\n" .
" bash /root/nodejs.sh && \\\n" .
" apt-get install -y nodejs";
if ($strOS eq VM_U18)
{
$strScript .= ' npm';
}
}
# Install Scality S3
@@ -348,21 +354,22 @@ sub containerBuild
else
{
$strScript .=
" export DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive && \\\n" .
" apt-get update && \\\n" .
" apt-get -y install wget python && \\\n" .
" 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 \\\n" .
" libyaml-libyaml-perl";
" libyaml-libyaml-perl tzdata";
if ($strOS eq VM_U12)
{
$strScript .= ' libperl5.14';
}
elsif ($strOS eq VM_U16)
elsif ($strOS eq VM_U18)
{
$strScript .= ' clang-5.0 lcov';
$strScript .= ' clang-6.0 clang-tools-6.0 lcov';
}
}
@@ -469,12 +476,15 @@ sub containerBuild
$$oVm{$strOS}{&VM_OS_REPO} . '-pgdg main' . ($strOS ne VM_U12 ? ' 11' : '') .
"' >> /etc/apt/sources.list.d/pgdg.list && \\\n" .
" wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \\\n" .
" apt-get update";
" apt-get update && \\\n" .
" apt-get install -y postgresql-common && \\\n" .
" sed -i 's/^\\#create\\_main\\_cluster.*\$/create\\_main\\_cluster \\= false/' " .
"/etc/postgresql-common/createcluster.conf";
}
if (defined($oOS->{&VM_DB}) && @{$oOS->{&VM_DB}} > 0)
{
$strScript .= sectionHeader() .
$strScript .= sectionHeader() .
"# Install Postgresql\n";
if ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_RHEL)
@@ -487,8 +497,6 @@ sub containerBuild
}
# Construct list of databases to install
my $strRunAfterInstall;
foreach my $strDbVersion (@{$oOS->{&VM_DB}})
{
if ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_RHEL)
@@ -501,17 +509,8 @@ sub containerBuild
else
{
$strScript .= " postgresql-${strDbVersion}";
$strRunAfterInstall .= (defined($strRunAfterInstall) ? " && \\\n" : '') .
" pg_dropcluster --stop ${strDbVersion} main";
}
}
# If there are commands to run after install
if (defined($strRunAfterInstall))
{
$strScript .= " && \\\n" . $strRunAfterInstall;
}
}
}
@@ -632,15 +631,15 @@ sub containerBuild
}
else
{
$strImageParent = $oVm->{&VM_U16}{&VM_IMAGE};
$strImageParent = $oVm->{&VM_U18}{&VM_IMAGE};
$strScript = sectionHeader() .
"# Install required packages\n" .
" apt-get update && \\\n" .
" apt-get install -y wget git";
" apt-get install -y wget git gnupg";
$strScript .= certSetup();
$strScript .= s3ServerSetup(VM_U16);
$strScript .= s3ServerSetup(VM_U18);
$strScript .= sectionHeader() .
"# Fix root tty\n" .
@@ -670,6 +669,10 @@ sub containerBuild
"COPY ${strOS}-${strPkgDevelCover} /tmp/${strPkgDevelCover}";
$strScript = sectionHeader() .
"# Install packages\n" .
" apt-get install -y libjson-maybexs-perl";
$strScript .= sectionHeader() .
"# Install Devel::Cover\n" .
" dpkg -i /tmp/${strPkgDevelCover}";
}

View File

@@ -357,7 +357,8 @@ sub run
"CC=gcc\n" .
"CFLAGS=-I. -std=c99 -fPIC -g" . ($self->{bProfile} ? " -pg" : '') . "\\\n" .
" -Werror -Wfatal-errors -Wall -Wextra -Wwrite-strings -Wno-clobbered -Wswitch-enum -Wconversion \\\n" .
($self->{oTest}->{&TEST_VM} eq VM_U16 ? " -Wformat-signedness \\\n" : '') .
($self->{oTest}->{&TEST_VM} eq VM_U16 || $self->{oTest}->{&TEST_VM} eq VM_U18 ?
" -Wformat-signedness \\\n" : '') .
# This warning appears to be broken on U12 even though the functionality is fine
($self->{oTest}->{&TEST_VM} eq VM_U12 || $self->{oTest}->{&TEST_VM} eq VM_CO6 ?
" -Wno-missing-field-initializers \\\n" : '') .

View File

@@ -88,6 +88,8 @@ use constant VM_U14 => 'u14';
push @EXPORT, qw(VM_U14);
use constant VM_U16 => 'u16';
push @EXPORT, qw(VM_U16);
use constant VM_U18 => 'u18';
push @EXPORT, qw(VM_U18);
use constant VM_D8 => 'd8';
push @EXPORT, qw(VM_D8);
use constant VM_D9 => 'd9';
@@ -98,14 +100,14 @@ use constant VM_EXPECT => VM_CO7;
push @EXPORT, qw(VM_EXPECT);
# Defines the host VM (the VM that the containers run in)
use constant VM_HOST_DEFAULT => VM_U16;
use constant VM_HOST_DEFAULT => VM_U18;
push @EXPORT, qw(VM_HOST_DEFAULT);
# Defines the VM that will do coverage testing
use constant VM_COVERAGE => VM_U16;
use constant VM_COVERAGE => VM_U18;
# Lists valid VMs
use constant VM_LIST => (VM_U16, VM_CO6, VM_CO7, VM_U12);
use constant VM_LIST => (VM_U18, VM_CO6, VM_CO7, VM_U12);
push @EXPORT, qw(VM_LIST);
my $oyVm =
@@ -238,6 +240,32 @@ my $oyVm =
&VMDEF_WITH_BACKTRACE => true,
&VM_DB =>
[
PG_VERSION_94,
PG_VERSION_95,
],
&VM_DB_TEST =>
[
PG_VERSION_94,
PG_VERSION_95,
],
},
# Ubuntu 18.04
&VM_U18 =>
{
&VM_OS_BASE => VM_OS_BASE_DEBIAN,
&VM_OS => VM_OS_UBUNTU,
&VM_OS_REPO => 'bionic',
&VM_IMAGE => 'ubuntu:18.04',
&VM_ARCH => VM_ARCH_AMD64,
&VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin',
&VMDEF_PERL_ARCH_PATH => '/usr/local/lib/x86_64-linux-gnu/perl/5.26.1',
&VMDEF_WITH_BACKTRACE => true,
&VM_DB =>
[
PG_VERSION_94,

Binary file not shown.

Binary file not shown.

View File

@@ -433,7 +433,7 @@ eval
my $strLibC = executeTest(
"cd ${strBackRestBase}/libc && " .
"perl /usr/share/perl/5.22/ExtUtils/xsubpp -typemap /usr/share/perl/5.22/ExtUtils/typemap" .
"perl /usr/share/perl/5.26/ExtUtils/xsubpp -typemap /usr/share/perl/5.26/ExtUtils/typemap" .
" -typemap typemap LibC.xs");
# Trim off any trailing LFs
@@ -731,7 +731,7 @@ eval
executeTest(
'docker exec -i test-build' .
(vmCoverage($strVm) && !$bNoLint ? ' scan-build-5.0' : '') .
(vmCoverage($strVm) && !$bNoLint ? ' scan-build-6.0' : '') .
" make --silent --directory ${strBuildPath} CEXTRA=${strCExtra} LDEXTRA=${strLdExtra} ${strCDebug}",
{bShowOutputAsync => $bLogDetail});
@@ -913,7 +913,7 @@ eval
# Patch files in debian package builds
#
# Use these commands to create a new patch (may need to modify first line):
# BRDIR=/backrest;BRVM=u16;BRPATCHFILE=${BRDIR?}/test/patch/debian-package.patch
# BRDIR=/backrest;BRVM=u18;BRPATCHFILE=${BRDIR?}/test/patch/debian-package.patch
# DBDIR=${BRDIR?}/test/.vagrant/package/${BRVM}/src/debian
# diff -Naur ${DBDIR?}.old ${DBDIR}.new > ${BRPATCHFILE?}
my $strDebianPackagePatch = "${strBackRestBase}/test/patch/debian-package.patch";

View File

@@ -142,10 +142,10 @@ eval
confess &log(ERROR, '--vm is required');
}
# Only lint on U16
# Only lint on U18
my $strParam = undef;
if ($strVm ne VM_U16)
if ($strVm ne VM_U18)
{
$strParam .= '--no-lint';
}