summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorTom Lane2015-11-17 19:10:24 +0000
committerTom Lane2015-11-17 19:10:24 +0000
commit8bc496c3b68f6b5296eed3ebccc6f322d4d0ba52 (patch)
tree6a8c88729449186d5928c56d18a6bf155e9734dd /src/tools
parenta6c4c07fc5cd0665568ff48ada3b65900fafa1af (diff)
Back-patch fixes to make TAP tests work on Windows.
This back-ports commit 13d856e177e69083 and assorted followon patches into 9.4 and 9.5. 9.5 and HEAD are now substantially identical in all the files touched by this commit, except that 010_pg_basebackup.pl has a few more tests related to the new --slot option. 9.4 has many fewer TAP tests, but the test infrastructure files are substantially the same, with the exception that 9.4 lacks the single-tmp-install infrastructure introduced in 9.5 (commit dcae5faccab64776). The primary motivation for this patch is to ensure that TAP test case fixes can be back-patched without hazards of the kind seen in commits 34557f544/06dd4b44f. In principle it should also make the world safe for running the TAP tests in the buildfarm in these branches; although we might want to think about back-porting dcae5faccab64776 to 9.4 if we're going to do that for real, because the TAP tests are quite disk space hungry without it. Michael Paquier did the back-porting work; original patches were by him and assorted other people.
Diffstat (limited to 'src/tools')
-rwxr-xr-xsrc/tools/msvc/clean.bat6
-rw-r--r--src/tools/msvc/vcregress.pl45
2 files changed, 49 insertions, 2 deletions
diff --git a/src/tools/msvc/clean.bat b/src/tools/msvc/clean.bat
index e06838cc1ef..b071cb740cc 100755
--- a/src/tools/msvc/clean.bat
+++ b/src/tools/msvc/clean.bat
@@ -74,6 +74,12 @@ if exist src\test\regress\regress.dll del /q src\test\regress\regress.dll
if exist src\test\regress\refint.dll del /q src\test\regress\refint.dll
if exist src\test\regress\autoinc.dll del /q src\test\regress\autoinc.dll
+if exist src\bin\initdb\tmp_check rd /s /q src\bin\initdb\tmp_check
+if exist src\bin\pg_basebackup\tmp_check rd /s /q src\bin\pg_basebackup\tmp_check
+if exist src\bin\pg_config\tmp_check rd /s /q src\bin\pg_config\tmp_check
+if exist src\bin\pg_ctl\tmp_check rd /s /q src\bin\pg_ctl\tmp_check
+if exist src\bin\scripts\tmp_check rd /s /q src\bin\scripts\tmp_check
+
REM Clean up datafiles built with contrib
REM cd contrib
REM for /r %%f in (*.sql) do if exist %%f.in del %%f
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index 8f9fc790e30..84114205bb5 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -7,7 +7,9 @@ use strict;
our $config;
use Cwd;
+use File::Basename;
use File::Copy;
+use File::Find ();
use Install qw(Install);
@@ -31,7 +33,7 @@ if (-e "src/tools/msvc/buildenv.pl")
my $what = shift || "";
if ($what =~
-/^(check|installcheck|plcheck|contribcheck|ecpgcheck|isolationcheck|upgradecheck)$/i
+/^(check|installcheck|plcheck|contribcheck|ecpgcheck|isolationcheck|upgradecheck|tapcheck)$/i
)
{
$what = uc $what;
@@ -58,7 +60,7 @@ unless ($schedule)
$schedule = "parallel" if ($what eq 'CHECK' || $what =~ /PARALLEL/);
}
-$ENV{PERL5LIB} = "$topdir/src/tools/msvc";
+$ENV{PERL5LIB} = "$topdir/src/tools/msvc;$ENV{PERL5LIB}";
my $maxconn = "";
$maxconn = "--max_connections=$ENV{MAX_CONNECTIONS}"
@@ -77,6 +79,7 @@ my %command = (
ECPGCHECK => \&ecpgcheck,
CONTRIBCHECK => \&contribcheck,
ISOLATIONCHECK => \&isolationcheck,
+ TAPCHECK => \&tapcheck,
UPGRADECHECK => \&upgradecheck,);
my $proc = $command{$what};
@@ -162,6 +165,44 @@ sub isolationcheck
exit $status if $status;
}
+sub tapcheck
+{
+ my @args = ( "prove", "--verbose", "t/*.pl");
+ my $mstat = 0;
+
+ $ENV{PERL5LIB} = "$topdir/src/test/perl;$ENV{PERL5LIB}";
+ $ENV{PG_REGRESS} = "$topdir/$Config/pg_regress/pg_regress";
+
+ # Find out all the existing TAP tests by looking for t/ directories
+ # in the tree.
+ my $tap_dirs = [];
+ my @top_dir = ($topdir);
+ File::Find::find(
+ { wanted => sub {
+ /^t\z/s
+ && push(@$tap_dirs, $File::Find::name);
+ }
+ },
+ @top_dir);
+
+ # Process each test
+ foreach my $test_path (@$tap_dirs)
+ {
+ my $dir = dirname($test_path);
+ my $tmp_root = "$dir/tmp_check";
+ (mkdir $tmp_root || die $!) unless -d $tmp_root;
+ my $tmp_install = "$tmp_root/install";
+ Install($tmp_install, "all", $config);
+ chdir $dir;
+ # Reset those values, they may have been changed by another test.
+ $ENV{TESTDIR} = "$dir";
+ system(@args);
+ my $status = $? >> 8;
+ $mstat ||= $status;
+ }
+ exit $mstat if $mstat;
+}
+
sub plcheck
{
chdir "../../pl";