Skip to content

Commit a71db51

Browse files
author
Andrei Krichinin
committed
fix test scripts for PostgreSQL 15
1 parent 0b6494b commit a71db51

10 files changed

+97
-30
lines changed

t/000_deadlock.pl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
use warnings;
55

66
use Cluster;
7-
use TestLib;
87

98
# Test whether we have both DBI and DBD::pg
109
my $dbdpg_rc = eval

t/001_regress.pl

Lines changed: 70 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@
3434
}
3535

3636
# determenistic ports for expected files
37-
$PostgresNode::last_port_assigned = 55431;
37+
if ($Cluster::pg_15_modules)
38+
{
39+
$PostgreSQL::Test::Cluster::last_port_assigned = 55431;
40+
}
41+
else
42+
{
43+
$PostgresNode::last_port_assigned = 55431;
44+
}
3845

3946
my $cluster = new Cluster(3);
4047
$cluster->init(q{
@@ -84,13 +91,28 @@
8491

8592
# load schedule without tablespace test which is not expected
8693
# to work with several postgreses on a single node
87-
my $schedule = TestLib::slurp_file('../../src/test/regress/parallel_schedule');
94+
my $schedule;
95+
if ($Cluster::pg_15_modules)
96+
{
97+
$schedule = PostgreSQL::Test::Utils::slurp_file('../../src/test/regress/parallel_schedule');
98+
}
99+
else
100+
{
101+
$schedule = TestLib::slurp_file('../../src/test/regress/parallel_schedule');
102+
}
88103
$schedule =~ s/test: tablespace/#test: tablespace/g;
89104
$schedule =~ s/test: cfs/#test: cfs/g;
90105
$schedule =~ s/test: largeobject//; # serial schedule
91106
$schedule =~ s/largeobject//; # parallel schedule
92107
unlink('parallel_schedule');
93-
TestLib::append_to_file('parallel_schedule', $schedule);
108+
if ($Cluster::pg_15_modules)
109+
{
110+
PostgreSQL::Test::Utils::append_to_file('parallel_schedule', $schedule);
111+
}
112+
else
113+
{
114+
TestLib::append_to_file('parallel_schedule', $schedule);
115+
}
94116

95117
my $regress_shlib = $ENV{REGRESS_SHLIB};
96118
my $regress_libdir = dirname($regress_shlib);
@@ -99,13 +121,26 @@
99121
# REMOVEME: not needed in 14+, pg_regress fixed in upstream
100122
mkdir("${regress_outdir}/sql");
101123
mkdir("${regress_outdir}/expected");
102-
TestLib::system_log($ENV{'PG_REGRESS'},
103-
'--host=' . $cluster->{nodes}->[0]->host, '--port=' . $cluster->{nodes}->[0]->port,
104-
'--use-existing', '--bindir=',
105-
'--schedule=parallel_schedule',
106-
"--dlpath=${regress_libdir}",
107-
'--inputdir=../../src/test/regress',
108-
"--outputdir=${regress_outdir}");
124+
if ($Cluster::pg_15_modules)
125+
{
126+
PostgreSQL::Test::Utils::system_log($ENV{'PG_REGRESS'},
127+
'--host=' . $cluster->{nodes}->[0]->host, '--port=' . $cluster->{nodes}->[0]->port,
128+
'--use-existing', '--bindir=',
129+
'--schedule=parallel_schedule',
130+
"--dlpath=${regress_libdir}",
131+
'--inputdir=../../src/test/regress',
132+
"--outputdir=${regress_outdir}");
133+
}
134+
else
135+
{
136+
TestLib::system_log($ENV{'PG_REGRESS'},
137+
'--host=' . $cluster->{nodes}->[0]->host, '--port=' . $cluster->{nodes}->[0]->port,
138+
'--use-existing', '--bindir=',
139+
'--schedule=parallel_schedule',
140+
"--dlpath=${regress_libdir}",
141+
'--inputdir=../../src/test/regress',
142+
"--outputdir=${regress_outdir}");
143+
}
109144
unlink('parallel_schedule');
110145

111146
# rename s/diffs/diff as some upper level testing systems are searching for all
@@ -114,7 +149,15 @@
114149
or die "cannot rename file: $!";
115150

116151
# strip absolute paths and dates out of resulted regression.diffs
117-
my $res_diff = TestLib::slurp_file("${regress_outdir}/regression.diff");
152+
my $res_diff;
153+
if ($Cluster::pg_15_modules)
154+
{
155+
$res_diff = PostgreSQL::Test::Utils::slurp_file("${regress_outdir}/regression.diff");
156+
}
157+
else
158+
{
159+
$res_diff = TestLib::slurp_file("${regress_outdir}/regression.diff");
160+
}
118161
# In <= 11 default diff format was context, since 12 unified; handing lines
119162
# starting with ---|+++|*** covers both.
120163
# To make someone's life easier, we prepend .. to make relative paths correct.
@@ -134,7 +177,14 @@
134177
# finally compare regression.diffs with our version
135178
# Do not use diffs extension as some upper level testing systems are searching for all
136179
# *.diffs files.
137-
TestLib::append_to_file("$ENV{TESTDIR}/results/regression.diff", $res_diff);
180+
if ($Cluster::pg_15_modules)
181+
{
182+
PostgreSQL::Test::Utils::append_to_file("$ENV{TESTDIR}/results/regression.diff", $res_diff);
183+
}
184+
else
185+
{
186+
TestLib::append_to_file("$ENV{TESTDIR}/results/regression.diff", $res_diff);
187+
}
138188
# TODO: work with diffs on per-test basis
139189
my $expected_file;
140190
if (Cluster::is_ee())
@@ -145,7 +195,14 @@
145195
{
146196
$expected_file = "expected/regression_vanilla.diff"
147197
}
148-
$diff = TestLib::system_log("diff -U3 ${expected_file} $ENV{TESTDIR}/results/regression.diff");
198+
if ($Cluster::pg_15_modules)
199+
{
200+
$diff = PostgreSQL::Test::Utils::system_log("diff -U3 ${expected_file} $ENV{TESTDIR}/results/regression.diff");
201+
}
202+
else
203+
{
204+
$diff = TestLib::system_log("diff -U3 ${expected_file} $ENV{TESTDIR}/results/regression.diff");
205+
}
149206
run [ "diff", "-U3", "${expected_file}", "$ENV{TESTDIR}/results/regression.diff" ], ">", "$ENV{TESTDIR}/regression.diff.diff";
150207
my $res = $?;
151208

t/002_regressmm.pl

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
use Test::More tests => 1;
44

55
# determenistic ports for expected files
6-
$PostgresNode::last_port_assigned = 55431;
6+
if ($Cluster::pg_15_modules)
7+
{
8+
$PostgreSQL::Test::Cluster::last_port_assigned = 55431;
9+
}
10+
else
11+
{
12+
$PostgresNode::last_port_assigned = 55431;
13+
}
714

815
my $cluster = new Cluster(3);
916
$cluster->init(q{
@@ -23,11 +30,25 @@
2330
push @tests, 'atx';
2431
}
2532

26-
my $ret = TestLib::system_log($ENV{'PG_REGRESS'},
27-
'--host=' . $cluster->{nodes}->[0]->host, '--port=' . $cluster->{nodes}->[0]->port,
28-
'--use-existing', '--bindir=', @tests);
29-
if ($ret != 0)
33+
my $ret;
34+
if ($Cluster::pg_15_modules)
35+
{
36+
$ret = PostgreSQL::Test::Utils::system_log($ENV{'PG_REGRESS'},
37+
'--host=' . $cluster->{nodes}->[0]->host, '--port=' . $cluster->{nodes}->[0]->port,
38+
'--use-existing', '--bindir=', @tests);
39+
if ($ret != 0)
40+
{
41+
print "### Got regression! \n", PostgreSQL::Test::Utils::slurp_file('regression.diffs');
42+
}
43+
}
44+
else
3045
{
31-
print "### Got regression! \n", TestLib::slurp_file('regression.diffs');
46+
$ret = TestLib::system_log($ENV{'PG_REGRESS'},
47+
'--host=' . $cluster->{nodes}->[0]->host, '--port=' . $cluster->{nodes}->[0]->port,
48+
'--use-existing', '--bindir=', @tests);
49+
if ($ret != 0)
50+
{
51+
print "### Got regression! \n", TestLib::slurp_file('regression.diffs');
52+
}
3253
}
3354
is($ret, 0, "multimaster regress");

t/003_basic_recovery.pl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
use strict;
55
use warnings;
66
use Cluster;
7-
use TestLib;
87
use Test::More tests => 4;
98

109
my $cluster = new Cluster(3);

t/004_recovery.pl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
use warnings;
33

44
use Cluster;
5-
use TestLib;
65
use Test::More tests => 6;
76

87
my $cluster = new Cluster(3);

t/005_pgbench.pl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use warnings;
66

77
use Cluster;
8-
use TestLib;
98
use Test::More tests => 2;
109

1110
my $cluster = new Cluster(2);

t/006_pgbenchdl.pl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use warnings;
66

77
use Cluster;
8-
use TestLib;
98
use Test::More tests => 1;
109
use Data::Dumper;
1110

t/007_add_stop_node.pl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
use warnings;
33

44
use Carp;
5-
use PostgresNode;
65
use Cluster;
7-
use TestLib;
86
use Test::More tests => 8;
97

108
# Generally add node with concurrent load (and failures) is not supported

t/008_bugfixes.pl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
use POSIX;
33
use strict;
44
use Test::More;
5-
use TestLib;
65
use Time::HiRes qw(usleep);
76
use warnings;
87

9-
use PostgresNode;
108
use Cluster;
119

1210
use Test::More tests => Cluster::is_ee() ? 6 : 5;

t/009_identity_func.pl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use strict;
22
use warnings;
3-
use PostgresNode;
43
use Cluster;
5-
use TestLib;
64
use Test::More tests => 29;
75

86
my $cluster = new Cluster(3);

0 commit comments

Comments
 (0)