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

Commit13d856e

Browse files
committed
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 parent5f10660 commit13d856e

File tree

9 files changed

+232
-101
lines changed

9 files changed

+232
-101
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ $ENV{CONFIG}="Debug";
439439
<userinput>vcregress modulescheck</userinput>
440440
<userinput>vcregress ecpgcheck</userinput>
441441
<userinput>vcregress isolationcheck</userinput>
442+
<userinput>vcregress tapcheck</userinput>
442443
<userinput>vcregress upgradecheck</userinput>
443444
</screen>
444445

@@ -451,6 +452,29 @@ $ENV{CONFIG}="Debug";
451452
For more information about the regression tests, see
452453
<xref linkend="regress">.
453454
</para>
455+
456+
<para>
457+
Running the TAP regression tests, with "vcregress tapcheck", requires an
458+
additional Perl module to be installed:
459+
<variablelist>
460+
<varlistentry>
461+
<term><productname>IPC::Run</productname></term>
462+
<listitem><para>
463+
As of this writing, <literal>IPC::Run</> is not included in the
464+
ActiveState Perl installation, nor in the ActiveState Perl Package
465+
Manager (PPM) library. To install, download the
466+
<filename>IPC-Run-&lt;version&gt;.tar.gz</> source archive from CPAN,
467+
at <ulink url="http://search.cpan.org/dist/IPC-Run/"></>, and
468+
uncompress. Edit the <filename>buildenv.pl</> file, and add a PERL5LIB
469+
variable to point to the <filename>lib</> subdirectory from the
470+
extracted archive. For example:
471+
<programlisting>
472+
$ENV{PERL5LIB}=$ENV{PERL5LIB} . ';c:\IPC-Run-0.94\lib';
473+
</programlisting>
474+
</para></listitem>
475+
</varlistentry>
476+
</variablelist>
477+
</para>
454478
</sect2>
455479

456480
<sect2>

‎src/Makefile.global.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ endef
339339

340340
defineprove_check
341341
rm -rf$(CURDIR)/tmp_check/log
342-
cd$(srcdir) && TESTDIR='$(CURDIR)'$(with_temp_install) PGPORT='6$(DEF_PGPORT)'top_builddir='$(CURDIR)/$(top_builddir)'$(PROVE)$(PG_PROVE_FLAGS)$(PROVE_FLAGS) t/*.pl
342+
cd$(srcdir) && TESTDIR='$(CURDIR)'$(with_temp_install) PGPORT='6$(DEF_PGPORT)'PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress'$(PROVE)$(PG_PROVE_FLAGS)$(PROVE_FLAGS) t/*.pl
343343
endef
344344

345345
else

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

Lines changed: 72 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use strict;
22
use warnings;
33
use Cwd;
4+
use Config;
45
use TestLib;
56
use Test::Moretests=> 51;
67

@@ -25,11 +26,7 @@
2526
close BADCHARS;
2627
}
2728

28-
open HBA,">>$tempdir/pgdata/pg_hba.conf";
29-
print HBA"local replication all trust\n";
30-
print HBA"host replication all 127.0.0.1/32 trust\n";
31-
print HBA"host replication all ::1/128 trust\n";
32-
close HBA;
29+
configure_hba_for_replication"$tempdir/pgdata";
3330
system_or_bail'pg_ctl','-D',"$tempdir/pgdata",'reload';
3431

3532
command_fails(
@@ -62,61 +59,6 @@
6259
'tar format');
6360
ok(-f"$tempdir/tarbackup/base.tar",'backup tar was created');
6461

65-
my$superlongname ="superlongname_" . ("x"x100);
66-
67-
system_or_bail'touch',"$tempdir/pgdata/$superlongname";
68-
command_fails(['pg_basebackup','-D',"$tempdir/tarbackup_l1",'-Ft' ],
69-
'pg_basebackup tar with long name fails');
70-
unlink"$tempdir/pgdata/$superlongname";
71-
72-
# Create a temporary directory in the system location and symlink it
73-
# to our physical temp location. That way we can use shorter names
74-
# for the tablespace directories, which hopefully won't run afoul of
75-
# the 99 character length limit.
76-
my$shorter_tempdir = tempdir_short ."/tempdir";
77-
symlink"$tempdir",$shorter_tempdir;
78-
79-
mkdir"$tempdir/tblspc1";
80-
psql'postgres',
81-
"CREATE TABLESPACE tblspc1 LOCATION '$shorter_tempdir/tblspc1';";
82-
psql'postgres',"CREATE TABLE test1 (a int) TABLESPACE tblspc1;";
83-
command_ok(['pg_basebackup','-D',"$tempdir/tarbackup2",'-Ft' ],
84-
'tar format with tablespaces');
85-
ok(-f"$tempdir/tarbackup2/base.tar",'backup tar was created');
86-
my@tblspc_tars =glob"$tempdir/tarbackup2/[0-9]*.tar";
87-
is(scalar(@tblspc_tars), 1,'one tablespace tar was created');
88-
89-
command_fails(
90-
['pg_basebackup','-D',"$tempdir/backup1",'-Fp' ],
91-
'plain format with tablespaces fails without tablespace mapping');
92-
93-
command_ok(
94-
['pg_basebackup','-D',"$tempdir/backup1",'-Fp',
95-
"-T$shorter_tempdir/tblspc1=$tempdir/tbackup/tblspc1" ],
96-
'plain format with tablespaces succeeds with tablespace mapping');
97-
ok(-d"$tempdir/tbackup/tblspc1",'tablespace was relocated');
98-
opendir(my$dh,"$tempdir/pgdata/pg_tblspc")ordie;
99-
ok( (grep {
100-
-l"$tempdir/backup1/pg_tblspc/$_"
101-
andreadlink"$tempdir/backup1/pg_tblspc/$_"eq
102-
"$tempdir/tbackup/tblspc1"
103-
}readdir($dh)),
104-
"tablespace symlink was updated");
105-
closedir$dh;
106-
107-
mkdir"$tempdir/tbl=spc2";
108-
psql'postgres',"DROP TABLE test1;";
109-
psql'postgres',"DROP TABLESPACE tblspc1;";
110-
psql'postgres',
111-
"CREATE TABLESPACE tblspc2 LOCATION '$shorter_tempdir/tbl=spc2';";
112-
command_ok(
113-
['pg_basebackup','-D',"$tempdir/backup3",'-Fp',
114-
"-T$shorter_tempdir/tbl\\=spc2=$tempdir/tbackup/tbl\\=spc2" ],
115-
'mapping tablespace with = sign in path');
116-
ok(-d"$tempdir/tbackup/tbl=spc2",'tablespace with = sign was relocated');
117-
118-
psql'postgres',"DROP TABLESPACE tblspc2;";
119-
12062
command_fails(
12163
['pg_basebackup','-D',"$tempdir/backup_foo",'-Fp',"-T=/foo" ],
12264
'-T with empty old directory fails');
@@ -137,12 +79,75 @@
13779
['pg_basebackup','-D',"$tempdir/backup_foo",'-Fp',"-Tfoo" ],
13880
'-T with invalid format fails');
13981

140-
mkdir"$tempdir/$superlongname";
141-
psql'postgres',
142-
"CREATE TABLESPACE tblspc3 LOCATION '$tempdir/$superlongname';";
143-
command_ok(['pg_basebackup','-D',"$tempdir/tarbackup_l3",'-Ft' ],
144-
'pg_basebackup tar with long symlink target');
145-
psql'postgres',"DROP TABLESPACE tblspc3;";
82+
# Tar format doesn't support filenames longer than 100 bytes.
83+
my$superlongname ="superlongname_" . ("x"x100);
84+
my$superlongpath ="$tempdir/pgdata/$superlongname";
85+
86+
open FILE,">$superlongpath"ordie"unable to create file$superlongpath";
87+
close FILE;
88+
command_fails(['pg_basebackup','-D',"$tempdir/tarbackup_l1",'-Ft' ],
89+
'pg_basebackup tar with long name fails');
90+
unlink"$tempdir/pgdata/$superlongname";
91+
92+
# The following tests test symlinks. Windows doesn't have symlinks, so
93+
# skip on Windows.
94+
SKIP: {
95+
skip"symlinks not supported on Windows", 10if ($Config{osname}eq"MSWin32");
96+
97+
# Create a temporary directory in the system location and symlink it
98+
# to our physical temp location. That way we can use shorter names
99+
# for the tablespace directories, which hopefully won't run afoul of
100+
# the 99 character length limit.
101+
my$shorter_tempdir = tempdir_short ."/tempdir";
102+
symlink"$tempdir",$shorter_tempdir;
103+
104+
mkdir"$tempdir/tblspc1";
105+
psql'postgres',
106+
"CREATE TABLESPACE tblspc1 LOCATION '$shorter_tempdir/tblspc1';";
107+
psql'postgres',"CREATE TABLE test1 (a int) TABLESPACE tblspc1;";
108+
command_ok(['pg_basebackup','-D',"$tempdir/tarbackup2",'-Ft' ],
109+
'tar format with tablespaces');
110+
ok(-f"$tempdir/tarbackup2/base.tar",'backup tar was created');
111+
my@tblspc_tars =glob"$tempdir/tarbackup2/[0-9]*.tar";
112+
is(scalar(@tblspc_tars), 1,'one tablespace tar was created');
113+
114+
command_fails(
115+
['pg_basebackup','-D',"$tempdir/backup1",'-Fp' ],
116+
'plain format with tablespaces fails without tablespace mapping');
117+
118+
command_ok(
119+
['pg_basebackup','-D',"$tempdir/backup1",'-Fp',
120+
"-T$shorter_tempdir/tblspc1=$tempdir/tbackup/tblspc1" ],
121+
'plain format with tablespaces succeeds with tablespace mapping');
122+
ok(-d"$tempdir/tbackup/tblspc1",'tablespace was relocated');
123+
opendir(my$dh,"$tempdir/pgdata/pg_tblspc")ordie;
124+
ok( (grep {
125+
-l"$tempdir/backup1/pg_tblspc/$_"
126+
andreadlink"$tempdir/backup1/pg_tblspc/$_"eq
127+
"$tempdir/tbackup/tblspc1"
128+
}readdir($dh)),
129+
"tablespace symlink was updated");
130+
closedir$dh;
131+
132+
mkdir"$tempdir/tbl=spc2";
133+
psql'postgres',"DROP TABLE test1;";
134+
psql'postgres',"DROP TABLESPACE tblspc1;";
135+
psql'postgres',
136+
"CREATE TABLESPACE tblspc2 LOCATION '$shorter_tempdir/tbl=spc2';";
137+
command_ok(
138+
['pg_basebackup','-D',"$tempdir/backup3",'-Fp',
139+
"-T$shorter_tempdir/tbl\\=spc2=$tempdir/tbackup/tbl\\=spc2" ],
140+
'mapping tablespace with = sign in path');
141+
ok(-d"$tempdir/tbackup/tbl=spc2",'tablespace with = sign was relocated');
142+
psql'postgres',"DROP TABLESPACE tblspc2;";
143+
144+
mkdir"$tempdir/$superlongname";
145+
psql'postgres',
146+
"CREATE TABLESPACE tblspc3 LOCATION '$tempdir/$superlongname';";
147+
command_ok(['pg_basebackup','-D',"$tempdir/tarbackup_l3",'-Ft' ],
148+
'pg_basebackup tar with long symlink target');
149+
psql'postgres',"DROP TABLESPACE tblspc3;";
150+
}
146151

147152
command_ok(['pg_basebackup','-D',"$tempdir/backupR",'-R' ],
148153
'pg_basebackup -R runs');
@@ -169,7 +174,7 @@
169174
command_ok(['pg_basebackup','-D',"$tempdir/backupxs_sl",'-X','stream','-S','slot1' ],
170175
'pg_basebackup -X stream with replication slot runs');
171176
$lsn = psql'postgres',q{SELECT restart_lsn FROM pg_replication_slots WHERE slot_name = 'slot1'};
172-
like($lsn,qr!^0/[0-9A-Z]{8}$!,'restart LSN of slot has advanced');
177+
like($lsn,qr!^0/[0-9A-Z]{7,8}$!,'restart LSN of slot has advanced');
173178

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

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use strict;
22
use warnings;
3+
use Config;
34
use TestLib;
45
use Test::Moretests=> 17;
56

@@ -15,12 +16,19 @@
1516

1617
command_ok(['pg_ctl','initdb','-D',"$tempdir/data" ],'pg_ctl initdb');
1718
command_ok(
18-
["$ENV{top_builddir}/src/test/regress/pg_regress",'--config-auth',
19+
[$ENV{PG_REGRESS},'--config-auth',
1920
"$tempdir/data" ],
2021
'configure authentication');
2122
open CONF,">>$tempdir/data/postgresql.conf";
22-
print CONF"listen_addresses = ''\n";
23-
print CONF"unix_socket_directories = '$tempdir_short'\n";
23+
if ($Config{osname}ne"MSWin32")
24+
{
25+
print CONF"listen_addresses = ''\n";
26+
print CONF"unix_socket_directories = '$tempdir_short'\n";
27+
}
28+
else
29+
{
30+
print CONF"listen_addresses = '127.0.0.1'\n";
31+
}
2432
close CONF;
2533
command_ok(['pg_ctl','start','-D',"$tempdir/data",'-w' ],
2634
'pg_ctl start -w');

‎src/bin/pg_ctl/t/002_status.pl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
4,'pg_ctl status with nonexistent directory');
1111

1212
standard_initdb"$tempdir/data";
13-
open CONF,">>$tempdir/data/postgresql.conf";
14-
print CONF"listen_addresses = ''\n";
15-
print CONF"unix_socket_directories = '$tempdir_short'\n";
16-
close CONF;
1713

1814
command_exit_is(['pg_ctl','status','-D',"$tempdir/data" ],
1915
3,'pg_ctl status with server not running');

‎src/bin/pg_rewind/RewindTest.pm

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -192,20 +192,15 @@ max_connections = 10
192192
));
193193

194194
# Accept replication connections on master
195-
append_to_file(
196-
"$test_master_datadir/pg_hba.conf",qq(
197-
local replication all trust
198-
));
195+
configure_hba_for_replication$test_master_datadir;
199196

200197
system_or_bail('pg_ctl' ,'-w',
201198
'-D' ,$test_master_datadir,
202199
'-l',"$log_path/master.log",
203-
"-o","-k$tempdir_short --listen-addresses='' -p$port_master",
204-
'start');
200+
"-o","-p$port_master",'start');
205201

206202
#### Now run the test-specific parts to initialize the master before setting
207203
# up standby
208-
$ENV{PGHOST} =$tempdir_short;
209204
}
210205

211206
subcreate_standby
@@ -227,8 +222,7 @@ recovery_target_timeline='latest'
227222
# Start standby
228223
system_or_bail('pg_ctl','-w','-D',$test_standby_datadir,
229224
'-l',"$log_path/standby.log",
230-
'-o',"-k$tempdir_short --listen-addresses='' -p$port_standby",
231-
'start');
225+
'-o',"-p$port_standby",'start');
232226

233227
# Wait until the standby has caught up with the primary, by polling
234228
# pg_stat_replication.
@@ -264,7 +258,7 @@ sub run_pg_rewind
264258
my$test_mode =shift;
265259

266260
# Stop the master and be ready to perform the rewind
267-
system_or_bail('pg_ctl','-D',$test_master_datadir,'stop','-m','fast');
261+
system_or_bail('pg_ctl','-D',$test_master_datadir,'-m','fast','stop');
268262

269263
# At this point, the rewind processing is ready to run.
270264
# We now have a very simple scenario with a few diverged WAL record.
@@ -282,8 +276,8 @@ sub run_pg_rewind
282276
{
283277
# Do rewind using a local pgdata as source
284278
# Stop the master and be ready to perform the rewind
285-
system_or_bail('pg_ctl','-D',$test_standby_datadir,'stop',
286-
'-m','fast');
279+
system_or_bail('pg_ctl','-D',$test_standby_datadir,
280+
'-m','fast','stop');
287281
command_ok(['pg_rewind',
288282
"--debug",
289283
"--source-pgdata=$test_standby_datadir",
@@ -323,8 +317,7 @@ recovery_target_timeline='latest'
323317
# Restart the master to check that rewind went correctly
324318
system_or_bail('pg_ctl','-w','-D',$test_master_datadir,
325319
'-l',"$log_path/master.log",
326-
'-o',"-k$tempdir_short --listen-addresses='' -p$port_master",
327-
'start');
320+
'-o',"-p$port_master",'start');
328321

329322
#### Now run the test-specific parts to check the result
330323
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp