mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Make TAP tests work on Windows.
On Windows, use listen_address=127.0.0.1 to allow TCP connections. We were already using "pg_regress --config-auth" to set up HBA appropriately. The standard_initdb helper function now sets up the server's unix_socket_directories or listen_addresses in the config file, so that they don't need to be specified in the pg_ctl command line anymore. That way, the pg_ctl invocations in test programs don't need to differ between Windows and Unix. Add another helper function to configure the server's pg_hba.conf to allow replication connections. The configuration is done similarly to "pg_regress --config-auth": trust on domain sockets on Unix, and SSPI authentication on Windows. Replace calls to "cat" and "touch" programs with built-in perl code, as those programs don't normally exist on Windows. Add instructions in the docs on how to install IPC::Run on Windows. Adjust vcregress.pl to not replace PERL5LIB completely in vcregress.pl, because otherwise cannot install IPC::Run in a non-standard location easily. Michael Paquier, reviewed by Noah Misch, some additional tweaking by me.
This commit is contained in:
@ -7,7 +7,9 @@ use strict;
|
||||
our $config;
|
||||
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
use File::Copy;
|
||||
use File::Find ();
|
||||
|
||||
use Install qw(Install);
|
||||
|
||||
@ -32,7 +34,7 @@ if (-e "src/tools/msvc/buildenv.pl")
|
||||
|
||||
my $what = shift || "";
|
||||
if ($what =~
|
||||
/^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck)$/i
|
||||
/^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck|tapcheck)$/i
|
||||
)
|
||||
{
|
||||
$what = uc $what;
|
||||
@ -59,7 +61,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}"
|
||||
@ -79,6 +81,7 @@ my %command = (
|
||||
CONTRIBCHECK => \&contribcheck,
|
||||
MODULESCHECK => \&modulescheck,
|
||||
ISOLATIONCHECK => \&isolationcheck,
|
||||
TAPCHECK => \&tapcheck,
|
||||
UPGRADECHECK => \&upgradecheck,);
|
||||
|
||||
my $proc = $command{$what};
|
||||
@ -172,6 +175,45 @@ sub isolationcheck
|
||||
exit $status if $status;
|
||||
}
|
||||
|
||||
sub tapcheck
|
||||
{
|
||||
InstallTemp();
|
||||
|
||||
my @args = ( "prove", "--verbose", "t/*.pl");
|
||||
|
||||
$ENV{PATH} = "$tmp_installdir/bin;$ENV{PATH}";
|
||||
$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)
|
||||
{
|
||||
# Like on Unix "make check-world", don't run the SSL test suite
|
||||
# automatically.
|
||||
next if ($test_path =~ /\/src\/test\/ssl\//);
|
||||
|
||||
my $dir = dirname($test_path);
|
||||
chdir $dir;
|
||||
# Reset those values, they may have been changed by another test.
|
||||
$ENV{TESTDIR} = "$dir";
|
||||
system(@args);
|
||||
my $status = $? >> 8;
|
||||
exit $status if $status;
|
||||
}
|
||||
}
|
||||
|
||||
sub plcheck
|
||||
{
|
||||
chdir $startdir;
|
||||
|
Reference in New Issue
Block a user