mirror of
https://github.com/postgres/postgres.git
synced 2025-12-10 14:22:35 +03:00
Allow using Unix-domain sockets on Windows in tests
The test suites currently don't use Unix-domain sockets on Windows. This optionally allows enabling that by setting the environment variable PG_TEST_USE_UNIX_SOCKETS. This should currently be considered experimental. In particular, pg_regress.c contains some comments that the cleanup code for Unix-domain sockets doesn't work correctly under Windows, which hasn't been an problem until now. But it's good enough for locally supervised testing of the functionality. Reviewed-by: Andrew Dunstan <andrew.dunstan@2ndquadrant.com> Discussion: https://www.postgresql.org/message-id/flat/54bde68c-d134-4eb8-5bd3-8af33b72a010@2ndquadrant.com
This commit is contained in:
@@ -116,7 +116,7 @@ INIT
|
||||
|
||||
# Set PGHOST for backward compatibility. This doesn't work for own_host
|
||||
# nodes, so prefer to not rely on this when writing new tests.
|
||||
$use_tcp = $TestLib::windows_os;
|
||||
$use_tcp = !$TestLib::use_unix_sockets;
|
||||
$test_localhost = "127.0.0.1";
|
||||
$last_host_assigned = 1;
|
||||
$test_pghost = $use_tcp ? $test_localhost : TestLib::tempdir_short;
|
||||
@@ -387,7 +387,7 @@ sub set_replication_conf
|
||||
|
||||
open my $hba, '>>', "$pgdata/pg_hba.conf";
|
||||
print $hba "\n# Allow replication (set up by PostgresNode.pm)\n";
|
||||
if ($TestLib::windows_os)
|
||||
if ($TestLib::windows_os && !$TestLib::use_unix_sockets)
|
||||
{
|
||||
print $hba
|
||||
"host replication all $test_localhost/32 sspi include_realm=1 map=regress\n";
|
||||
|
||||
@@ -83,9 +83,10 @@ our @EXPORT = qw(
|
||||
command_checks_all
|
||||
|
||||
$windows_os
|
||||
$use_unix_sockets
|
||||
);
|
||||
|
||||
our ($windows_os, $tmp_check, $log_path, $test_logfile);
|
||||
our ($windows_os, $use_unix_sockets, $tmp_check, $log_path, $test_logfile);
|
||||
|
||||
BEGIN
|
||||
{
|
||||
@@ -117,6 +118,11 @@ BEGIN
|
||||
require Win32API::File;
|
||||
Win32API::File->import(qw(createFile OsFHandleOpen CloseHandle));
|
||||
}
|
||||
|
||||
# Specifies whether to use Unix sockets for test setups. On
|
||||
# Windows we don't use them by default since it's not universally
|
||||
# supported, but it can be overridden if desired.
|
||||
$use_unix_sockets = (!$windows_os || defined $ENV{PG_TEST_USE_UNIX_SOCKETS});
|
||||
}
|
||||
|
||||
=pod
|
||||
|
||||
Reference in New Issue
Block a user