From c9ce20d41a0c6edc3087511eaff5e0a80e95c8da Mon Sep 17 00:00:00 2001 From: David Steele Date: Mon, 9 Apr 2018 16:46:36 -0400 Subject: [PATCH] Skip version checks when testing in --dev mode. --- doc/xml/release.xml | 2 +- test/test.pl | 94 +++++++++++++++++++++++++-------------------- 2 files changed, 53 insertions(+), 43 deletions(-) diff --git a/doc/xml/release.xml b/doc/xml/release.xml index ca892e2c5..c6f8c66df 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -112,7 +112,7 @@ -

Improve logic for smart builds to include version changes.

+

Improve logic for smart builds to include version changes. Skip version checks when testing in --dev mode.

diff --git a/test/test.pl b/test/test.pl index 9f0c6ae88..d9f441ead 100755 --- a/test/test.pl +++ b/test/test.pl @@ -45,8 +45,6 @@ use pgBackRestBuild::Config::BuildParse; use pgBackRestBuild::Error::Build; use pgBackRestBuild::Error::Data; -use BackRestDoc::Custom::DocCustomRelease; - use pgBackRestTest::Common::BuildTest; use pgBackRestTest::Common::ContainerTest; use pgBackRestTest::Common::CiTest; @@ -401,53 +399,65 @@ eval (new pgBackRestTest::Common::CiTest($oStorageBackRest))->process(); } - &log(INFO, "check version info"); - - # Load the doc module dynamically since it is not supported on all systems - require BackRestDoc::Common::Doc; - BackRestDoc::Common::Doc->import(); - - # Make sure version number matches the latest release - my $strReleaseFile = dirname(dirname(abs_path($0))) . '/doc/xml/release.xml'; - my $oRelease = (new BackRestDoc::Custom::DocCustomRelease(new BackRestDoc::Common::Doc($strReleaseFile)))->releaseLast(); - my $strVersion = $oRelease->paramGet('version'); - my $bVersionDev = false; - my $strVersionBase = $strVersion; - - if ($strVersion =~ /dev$/) - { - $bVersionDev = true; - $strVersionBase = substr($strVersion, 0, length($strVersion) - 3); - - if (BACKREST_VERSION !~ /dev$/ && $oRelease->nodeTest('release-core-list')) - { - confess "dev release ${strVersion} must match the program version when core changes have been made"; - } - } - elsif ($strVersion ne BACKREST_VERSION) - { - confess 'unable to find version ' . BACKREST_VERSION . " as the most recent release in ${strReleaseFile}"; - } - - # Update version for the C code based on the current Perl version + # Check Perl version against release notes and update version in C code if needed #--------------------------------------------------------------------------------------------------------------------------- - my $strCVersionFile = "${strBackRestBase}/src/version.h"; - my $strCVersionOld = ${$oStorageTest->get($strCVersionFile)}; - my $strCVersionNew; + my $bVersionDev = true; + my $strVersionBase; - foreach my $strLine (split("\n", $strCVersionOld)) + if (!$bDev) { - if ($strLine =~ /^#define PGBACKREST_VERSION/) + # Make sure version number matches the latest release + #----------------------------------------------------------------------------------------------------------------------- + &log(INFO, "check version info"); + + # Load the doc modules dynamically since they are not supported on all systems + require BackRestDoc::Common::Doc; + BackRestDoc::Common::Doc->import(); + require BackRestDoc::Custom::DocCustomRelease; + BackRestDoc::Custom::DocCustomRelease->import(); + + my $strReleaseFile = dirname(dirname(abs_path($0))) . '/doc/xml/release.xml'; + my $oRelease = + (new BackRestDoc::Custom::DocCustomRelease(new BackRestDoc::Common::Doc($strReleaseFile)))->releaseLast(); + my $strVersion = $oRelease->paramGet('version'); + $bVersionDev = false; + $strVersionBase = $strVersion; + + if ($strVersion =~ /dev$/) { - $strLine = '#define PGBACKREST_VERSION' . (' ' x 42) . '"' . BACKREST_VERSION . '"'; + $bVersionDev = true; + $strVersionBase = substr($strVersion, 0, length($strVersion) - 3); + + if (BACKREST_VERSION !~ /dev$/ && $oRelease->nodeTest('release-core-list')) + { + confess "dev release ${strVersion} must match the program version when core changes have been made"; + } + } + elsif ($strVersion ne BACKREST_VERSION) + { + confess 'unable to find version ' . BACKREST_VERSION . " as the most recent release in ${strReleaseFile}"; } - $strCVersionNew .= "${strLine}\n"; - } + # Update version for the C code based on the current Perl version + #----------------------------------------------------------------------------------------------------------------------- + my $strCVersionFile = "${strBackRestBase}/src/version.h"; + my $strCVersionOld = ${$oStorageTest->get($strCVersionFile)}; + my $strCVersionNew; - if ($strCVersionNew ne $strCVersionOld) - { - $oStorageTest->put($strCVersionFile, $strCVersionNew); + foreach my $strLine (split("\n", $strCVersionOld)) + { + if ($strLine =~ /^#define PGBACKREST_VERSION/) + { + $strLine = '#define PGBACKREST_VERSION' . (' ' x 42) . '"' . BACKREST_VERSION . '"'; + } + + $strCVersionNew .= "${strLine}\n"; + } + + if ($strCVersionNew ne $strCVersionOld) + { + $oStorageTest->put($strCVersionFile, $strCVersionNew); + } } # Clean up