From 7f369006b5c812d0d3e05f4735d03623c3873b45 Mon Sep 17 00:00:00 2001 From: David Steele Date: Wed, 9 Oct 2019 15:03:03 -0400 Subject: [PATCH] Add gcc 9 support. A number of tests have been updated and Fedora 30 has been added to the test suite so the unit tests can run on gcc 9. Stop running unit tests on co6/7 since we appear to have ample unit test coverage. --- .travis.yml | 5 ++-- test/container.yaml | 5 +++- test/lib/pgBackRestTest/Common/CiTest.pm | 1 + .../pgBackRestTest/Common/ContainerTest.pm | 7 +++++ test/lib/pgBackRestTest/Common/JobTest.pm | 6 ++-- test/lib/pgBackRestTest/Common/VmTest.pm | 30 +++++++++++++++++++ .../Module/Info/InfoInfoArchivePerlTest.pm | 2 +- test/src/common/harnessTest.c | 2 +- test/src/module/command/archiveCommonTest.c | 2 +- test/src/module/common/regExpTest.c | 12 ++++++-- test/travis.pl | 6 +++- 11 files changed, 67 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1c8f2b1eb..0b7998543 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,14 +14,15 @@ services: matrix: include: - env: PGB_CI="--vm=u12 test" + - env: PGB_CI="--vm=f30 test" - env: PGB_CI="--vm=co6 test" - - env: PGB_CI="--vm=co7 test" - env: PGB_CI="--vm=u18 test" - env: PGB_CI="--vm=u18 doc" + - env: PGB_CI="--vm=co7 test" - dist: bionic env: PGB_CI="--vm=none test" - - env: PGB_CI="--vm=co7 doc" - env: PGB_CI="--vm=co6 doc" + - env: PGB_CI="--vm=co7 doc" install: - umask 0022 diff --git a/test/container.yaml b/test/container.yaml index 1a79fc912..e9db999b5 100644 --- a/test/container.yaml +++ b/test/container.yaml @@ -9,10 +9,13 @@ # - if Dockerfile has not changed, comment out vm hash below and use --vm-force when building # # To upload a new image: -# - docker login +# - docker login -u pgbackrest # - docker tag pgbackrest/test:{vm}-base pgbackrest/test:{vm}-base-YYYYMMDDA # - docker push pgbackrest/test:{vm}-base-YYYYMMDDA # ********************************************************************************************************************************** +20191009A: + f30: 8b21005a76a74f1e34bc86ccb319b7d56ec3586d + 20190926A: u18: 9a6456313490a68de01e5bae6876b1d598a00ef5 diff --git a/test/lib/pgBackRestTest/Common/CiTest.pm b/test/lib/pgBackRestTest/Common/CiTest.pm index e07586181..7bdaa2a17 100644 --- a/test/lib/pgBackRestTest/Common/CiTest.pm +++ b/test/lib/pgBackRestTest/Common/CiTest.pm @@ -99,6 +99,7 @@ sub process " - env: PGB_CI=\"--vm=u18 doc\"\n" . " - dist: bionic\n" . " env: PGB_CI=\"--vm=none test\"\n" . + " env: PGB_CI=\"--vm=f30 test\"\n" . " - env: PGB_CI=\"--vm=co7 doc\"\n" . " - env: PGB_CI=\"--vm=co6 doc\"\n"; diff --git a/test/lib/pgBackRestTest/Common/ContainerTest.pm b/test/lib/pgBackRestTest/Common/ContainerTest.pm index 121061055..497075022 100755 --- a/test/lib/pgBackRestTest/Common/ContainerTest.pm +++ b/test/lib/pgBackRestTest/Common/ContainerTest.pm @@ -493,6 +493,13 @@ sub containerBuild " https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/" . "pgdg-redhat-repo-latest.noarch.rpm && \\\n"; } + elsif ($strOS eq VM_F30) + { + $strScript .= + " rpm -ivh \\\n" . + " https://download.postgresql.org/pub/repos/yum/reporpms/F-30-x86_64/" . + "pgdg-fedora-repo-latest.noarch.rpm && \\\n"; + } $strScript .= " yum -y install postgresql-devel"; } diff --git a/test/lib/pgBackRestTest/Common/JobTest.pm b/test/lib/pgBackRestTest/Common/JobTest.pm index 80563015e..356959443 100644 --- a/test/lib/pgBackRestTest/Common/JobTest.pm +++ b/test/lib/pgBackRestTest/Common/JobTest.pm @@ -455,7 +455,8 @@ sub run # Flags used to build test.c my $strTestFlags = ($self->{bDebug} ? '-DDEBUG_TEST_TRACE ' : '') . - '-O0' . ($self->{oTest}->{&TEST_VM} ne VM_U12 ? ' -ftree-coalesce-vars' : '') . + ($self->{oTest}->{&TEST_VM} eq VM_F30 ? '-O2' : '-O0') . + ($self->{oTest}->{&TEST_VM} ne VM_U12 ? ' -ftree-coalesce-vars' : '') . (vmCoverageC($self->{oTest}->{&TEST_VM}) && $self->{bCoverageUnit} ? ' -fprofile-arcs -ftest-coverage' : '') . ($self->{oTest}->{&TEST_CTESTDEF} ? " $self->{oTest}->{&TEST_CTESTDEF}" : ''); @@ -466,7 +467,8 @@ sub run # Flags used to build all other files my $strBuildFlags = - ($self->{bOptimize} ? '-O2' : '-O0' . ($self->{oTest}->{&TEST_VM} ne VM_U12 ? ' -ftree-coalesce-vars' : '')); + ($self->{bOptimize} || $self->{oTest}->{&TEST_VM} eq VM_F30 ? + '-O2' : '-O0' . ($self->{oTest}->{&TEST_VM} ne VM_U12 ? ' -ftree-coalesce-vars' : '')); buildPutDiffers( $self->{oStorageTest}, "$self->{strGCovPath}/buildflags", diff --git a/test/lib/pgBackRestTest/Common/VmTest.pm b/test/lib/pgBackRestTest/Common/VmTest.pm index 67889d98d..2cf957e60 100644 --- a/test/lib/pgBackRestTest/Common/VmTest.pm +++ b/test/lib/pgBackRestTest/Common/VmTest.pm @@ -87,6 +87,8 @@ use constant VM_CO6 => 'co6'; push @EXPORT, qw(VM_CO6); use constant VM_CO7 => 'co7'; push @EXPORT, qw(VM_CO7); +use constant VM_F30 => 'f30'; + push @EXPORT, qw(VM_F30); use constant VM_U12 => 'u12'; push @EXPORT, qw(VM_U12); use constant VM_U14 => 'u14'; @@ -202,6 +204,34 @@ my $oyVm = ], }, + # Fedora 30 + &VM_F30 => + { + &VM_OS_BASE => VM_OS_BASE_RHEL, + &VM_OS => VM_OS_CENTOS, + &VM_IMAGE => 'fedora:30', + &VM_ARCH => VM_ARCH_AMD64, + &VMDEF_PGSQL_BIN => '/usr/pgsql-{[version]}/bin', + &VMDEF_PERL_ARCH_PATH => '/usr/local/lib64/perl5', + + &VMDEF_DEBUG_INTEGRATION => false, + + &VM_DB => + [ + PG_VERSION_94, + PG_VERSION_95, + PG_VERSION_96, + PG_VERSION_10, + PG_VERSION_11, + PG_VERSION_12, + ], + + &VM_DB_TEST => + [ + PG_VERSION_11, + ], + }, + # Debian 8 &VM_D8 => { diff --git a/test/lib/pgBackRestTest/Module/Info/InfoInfoArchivePerlTest.pm b/test/lib/pgBackRestTest/Module/Info/InfoInfoArchivePerlTest.pm index e6dd072b8..1305a1997 100644 --- a/test/lib/pgBackRestTest/Module/Info/InfoInfoArchivePerlTest.pm +++ b/test/lib/pgBackRestTest/Module/Info/InfoInfoArchivePerlTest.pm @@ -106,7 +106,7 @@ sub run # Attempt to reconstruct from an encypted archived WAL for an unencrypted repo #--------------------------------------------------------------------------------------------------------------------------- # Prepend encryption Magic signature to simulate encryption - executeTest('echo "' . CIPHER_MAGIC . '$(cat ' . $strArchiveFile . ')" > ' . $strArchiveFile); + executeTest('echo "' . CIPHER_MAGIC . '" > ' . $strArchiveFile); $self->testException(sub {$oArchiveInfo->reconstruct(PG_VERSION_94, $self->dbSysId(PG_VERSION_94))}, ERROR_CRYPTO, "encryption incompatible for '$strArchiveFile'" . diff --git a/test/src/common/harnessTest.c b/test/src/common/harnessTest.c index c0bf5b5a8..055826d1b 100644 --- a/test/src/common/harnessTest.c +++ b/test/src/common/harnessTest.c @@ -522,7 +522,7 @@ hrnDiff(const char *actual, const char *expected) hrnFileWrite(expectedFile, (unsigned char *)expected, strlen(expected)); // Perform diff - char command[2048]; + char command[2560]; snprintf(command, sizeof(command), "diff -u %s %s > %s/diff.result", actualFile, expectedFile, testDataPath()); if (system(command) == 2) diff --git a/test/src/module/command/archiveCommonTest.c b/test/src/module/command/archiveCommonTest.c index 03f137505..006dac903 100644 --- a/test/src/module/command/archiveCommonTest.c +++ b/test/src/module/command/archiveCommonTest.c @@ -241,7 +241,7 @@ testRun(void) ", 123456781234567812345678-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.gz" "\nHINT: are multiple primaries archiving to this stanza?"); - TEST_RESULT_STR( + TEST_RESULT_PTR( walSegmentFind(storageRepo(), strNew("9.6-2"), strNew("123456781234567812345678.partial"), 0), NULL, "did not find partial segment"); } diff --git a/test/src/module/common/regExpTest.c b/test/src/module/common/regExpTest.c index 240474e57..4ddd38306 100644 --- a/test/src/module/common/regExpTest.c +++ b/test/src/module/common/regExpTest.c @@ -13,7 +13,16 @@ testRun(void) // ***************************************************************************************************************************** if (testBegin("regExpNew(), regExpMatch(), and regExpFree()")) { - TEST_ERROR(regExpNew(strNew("[[[")), FormatError, "Unmatched [ or [^"); + // Error message varies based on the libc version + TRY_BEGIN() + { + TEST_ERROR(regExpNew(strNew("[[[")), FormatError, "Unmatched [ or [^"); + } + CATCH(AssertError) + { + TEST_ERROR(regExpNew(strNew("[[[")), FormatError, "Unmatched [, [^, [:, [., or [="); + } + TRY_END(); RegExp *regExp = NULL; TEST_ASSIGN(regExp, regExpNew(strNew("^abc")), "new regexp"); @@ -50,7 +59,6 @@ testRun(void) // ***************************************************************************************************************************** if (testBegin("regExpMatchOne()")) { - TEST_ERROR(regExpMatchOne(strNew("[[["), strNew("")), FormatError, "Unmatched [ or [^"); TEST_RESULT_BOOL(regExpMatchOne(strNew("^abc"), strNew("abcdef")), true, "match regexp"); TEST_RESULT_BOOL(regExpMatchOne(strNew("^abc"), strNew("bcdef")), false, "no match regexp"); } diff --git a/test/travis.pl b/test/travis.pl index cade1e22b..e5f4cfa80 100755 --- a/test/travis.pl +++ b/test/travis.pl @@ -203,9 +203,13 @@ eval { $strParam .= " --container-only"; } + elsif ($strVm eq VM_F30) + { + $strParam .= " --no-package --c-only"; + } elsif ($strVm ne VM_U12) { - $strParam .= " --module=command --module=mock --module=real --module=storage --module=performance"; + $strParam .= " --module=real"; } }