Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc2286f4

Browse files
hlinnakaegor-rogov
authored andcommitted
Make TAP tests work on Windows.
On Windows, use listen_address=127.0.0.1 to allow TCP connections. We werealready using "pg_regress --config-auth" to set up HBA appropriately. Thestandard_initdb helper function now sets up the server'sunix_socket_directories or listen_addresses in the config file, so thatthey don't need to be specified in the pg_ctl command line anymore. Thatway, the pg_ctl invocations in test programs don't need to differ betweenWindows and Unix.Add another helper function to configure the server's pg_hba.conf to allowreplication connections. The configuration is done similarly to "pg_regress--config-auth": trust on domain sockets on Unix, and SSPI authentication onWindows.Replace calls to "cat" and "touch" programs with built-in perl code, asthose programs don't normally exist on Windows.Add instructions in the docs on how to install IPC::Run on Windows. Adjustvcregress.pl to not replace PERL5LIB completely in vcregress.pl, becauseotherwise cannot install IPC::Run in a non-standard location easily.Michael Paquier, reviewed by Noah Misch, some additional tweaking by me.
1 parent0b16f15 commitc2286f4

File tree

7 files changed

+59
-28
lines changed

7 files changed

+59
-28
lines changed

‎doc/src/sgml/install-windows.sgml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ $ENV{CONFIG}="Debug";
439439
<userinput>vcregress modulescheck</userinput>
440440
<userinput>vcregress ecpgcheck</userinput>
441441
<userinput>vcregress isolationcheck</userinput>
442-
<userinput>vcregressbincheck</userinput>
442+
<userinput>vcregresstapcheck</userinput>
443443
<userinput>vcregress upgradecheck</userinput>
444444
</screen>
445445

@@ -454,8 +454,8 @@ $ENV{CONFIG}="Debug";
454454
</para>
455455

456456
<para>
457-
Running the regression tests on client programs, with "vcregressbincheck",
458-
requires anadditional Perl module to be installed:
457+
Running theTAPregression tests, with "vcregresstapcheck", requires an
458+
additional Perl module to be installed:
459459
<variablelist>
460460
<varlistentry>
461461
<term><productname>IPC::Run</productname></term>

‎src/bin/pg_basebackup/t/010_pg_basebackup.pl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
# The following tests test symlinks. Windows doesn't have symlinks, so
9393
# skip on Windows.
9494
SKIP: {
95-
skip"symlinks not supported on Windows", 10if ($windows_os);
95+
skip"symlinks not supported on Windows", 10if ($Config{osname}eq"MSWin32");
9696

9797
# Create a temporary directory in the system location and symlink it
9898
# to our physical temp location. That way we can use shorter names
@@ -176,7 +176,7 @@
176176
command_ok(['pg_basebackup','-D',"$tempdir/backupxs_sl",'-X','stream','-S','slot1' ],
177177
'pg_basebackup -X stream with replication slot runs');
178178
$lsn = psql'postgres',q{SELECT restart_lsn FROM pg_replication_slots WHERE slot_name = 'slot1'};
179-
like($lsn,qr!^0/[0-9A-Z]{8}$!,'restart LSN of slot has advanced');
179+
like($lsn,qr!^0/[0-9A-Z]{7,8}$!,'restart LSN of slot has advanced');
180180

181181
command_ok(['pg_basebackup','-D',"$tempdir/backupxs_sl_R",'-X','stream','-S','slot1','-R' ],
182182
'pg_basebackup with replication slot and -R runs');

‎src/bin/pg_ctl/t/001_start_stop.pl‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
"$tempdir/data" ],
2222
'configure authentication');
2323
open CONF,">>$tempdir/data/postgresql.conf";
24-
print CONF"fsync = off\n";
25-
if (!$windows_os)
24+
if ($Config{osname}ne"MSWin32")
2625
{
2726
print CONF"listen_addresses = ''\n";
2827
print CONF"unix_socket_directories = '$tempdir_short'\n";

‎src/bin/pg_rewind/RewindTest.pm‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ max_connections = 10
188188

189189
# Accept replication connections on master
190190
configure_hba_for_replication$test_master_datadir;
191-
}
192191

193192
substart_master
194193
{
@@ -222,8 +221,12 @@ recovery_target_timeline='latest'
222221
'-l',"$log_path/standby.log",
223222
'-o',"-p$port_standby",'start');
224223

225-
# The standby may have WAL to apply before it matches the primary. That
226-
# is fine, because no test examines the standby before promotion.
224+
# Wait until the standby has caught up with the primary, by polling
225+
# pg_stat_replication.
226+
my$caughtup_query =
227+
"SELECT pg_current_xlog_location() = replay_location FROM pg_stat_replication WHERE application_name = 'rewind_standby';";
228+
poll_query_until($caughtup_query,$connstr_master)
229+
ordie"Timed out while waiting for standby to catch up";
227230
}
228231

229232
subpromote_standby

‎src/test/perl/TestLib.pm‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ sub standard_initdb
143143

144144
open CONF,">>$pgdata/postgresql.conf";
145145
print CONF"\n# Added by TestLib.pm)\n";
146-
print CONF"fsync = off\n";
147-
if ($windows_os)
146+
if ($Config{osname}eq"MSWin32")
148147
{
149148
print CONF"listen_addresses = '127.0.0.1'\n";
150149
}
@@ -155,7 +154,7 @@ sub standard_initdb
155154
}
156155
close CONF;
157156

158-
$ENV{PGHOST} =$windows_os ?"127.0.0.1" :$tempdir_short;
157+
$ENV{PGHOST} =($Config{osname}eq"MSWin32") ?"127.0.0.1" :$tempdir_short;
159158
}
160159

161160
# Set up the cluster to allow replication connections, in the same way that
@@ -166,7 +165,7 @@ sub configure_hba_for_replication
166165

167166
open HBA,">>$pgdata/pg_hba.conf";
168167
print HBA"\n# Allow replication (set up by TestLib.pm)\n";
169-
if (!$windows_os)
168+
if ($Config{osname}ne"MSWin32")
170169
{
171170
print HBA"local replication all trust\n";
172171
}
@@ -190,7 +189,7 @@ sub start_test_server
190189
standard_initdb"$tempdir/pgdata";
191190

192191
$ret = system_log('pg_ctl','-D',"$tempdir/pgdata",'-w','-l',
193-
"$log_path/postmaster.log",'-o',"--log-statement=all",
192+
"$log_path/postmaster.log",'-o',"--fsync=off --log-statement=all",
194193
'start');
195194

196195
if ($ret != 0)

‎src/tools/msvc/clean.bat‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,8 @@ if exist src\test\regress\autoinc.dll del /q src\test\regress\autoinc.dll
9292
ifexist src\bin\initdb\tmp_checkrd /s /q src\bin\initdb\tmp_check
9393
ifexist src\bin\pg_basebackup\tmp_checkrd /s /q src\bin\pg_basebackup\tmp_check
9494
ifexist src\bin\pg_config\tmp_checkrd /s /q src\bin\pg_config\tmp_check
95-
ifexist src\bin\pg_controldata\tmp_checkrd /s /q src\bin\pg_controldata\tmp_check
9695
ifexist src\bin\pg_ctl\tmp_checkrd /s /q src\bin\pg_ctl\tmp_check
9796
ifexist src\bin\pg_rewind\tmp_checkrd /s /q src\bin\pg_rewind\tmp_check
98-
ifexist src\bin\pgbench\tmp_checkrd /s /q src\bin\pgbench\tmp_check
9997
ifexist src\bin\scripts\tmp_checkrd /s /q src\bin\scripts\tmp_check
10098

10199
REM Clean up datafiles built with contrib

‎src/tools/msvc/vcregress.pl‎

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
my$what =shift ||"";
3636
if ($what =~
37-
/^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck|bincheck)$/i
37+
/^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck|tapcheck)$/i
3838
)
3939
{
4040
$what =uc$what;
@@ -61,14 +61,7 @@
6161
$schedule ="parallel"if ($whateq'CHECK' ||$what =~/PARALLEL/);
6262
}
6363

64-
if ($ENV{PERL5LIB})
65-
{
66-
$ENV{PERL5LIB} ="$topdir/src/tools/msvc;$ENV{PERL5LIB}";
67-
}
68-
else
69-
{
70-
$ENV{PERL5LIB} ="$topdir/src/tools/msvc";
71-
}
64+
$ENV{PERL5LIB} ="$topdir/src/tools/msvc;$ENV{PERL5LIB}";
7265

7366
my$maxconn ="";
7467
$maxconn ="--max_connections=$ENV{MAX_CONNECTIONS}"
@@ -88,7 +81,7 @@
8881
CONTRIBCHECK=> \&contribcheck,
8982
MODULESCHECK=> \&modulescheck,
9083
ISOLATIONCHECK=> \&isolationcheck,
91-
BINCHECK=> \&bincheck,
84+
TAPCHECK=> \&tapcheck,
9285
UPGRADECHECK=> \&upgradecheck,);
9386

9487
my$proc =$command{$what};
@@ -175,7 +168,46 @@ sub isolationcheck
175168
exit$statusif$status;
176169
}
177170

178-
subtap_check
171+
subtapcheck
172+
{
173+
InstallTemp();
174+
175+
my@args = ("prove","--verbose","t/*.pl");
176+
177+
$ENV{PATH} ="$tmp_installdir/bin;$ENV{PATH}";
178+
$ENV{PERL5LIB} ="$topdir/src/test/perl;$ENV{PERL5LIB}";
179+
$ENV{PG_REGRESS} ="$topdir/$Config/pg_regress/pg_regress";
180+
181+
# Find out all the existing TAP tests by looking for t/ directories
182+
# in the tree.
183+
my$tap_dirs = [];
184+
my@top_dir = ($topdir);
185+
File::Find::find(
186+
{wanted=>sub {
187+
/^t\z/s
188+
&&push(@$tap_dirs,$File::Find::name);
189+
}
190+
},
191+
@top_dir);
192+
193+
# Process each test
194+
foreachmy$test_path (@$tap_dirs)
195+
{
196+
# Like on Unix "make check-world", don't run the SSL test suite
197+
# automatically.
198+
nextif ($test_path =~/\/src\/test\/ssl\//);
199+
200+
my$dir = dirname($test_path);
201+
chdir$dir;
202+
# Reset those values, they may have been changed by another test.
203+
$ENV{TESTDIR} ="$dir";
204+
system(@args);
205+
my$status =$? >> 8;
206+
exit$statusif$status;
207+
}
208+
}
209+
210+
subplcheck
179211
{
180212
die"Tap tests not enabled in configuration"
181213
unless$config->{tap_tests};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp