Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 40b132c

Browse files
committed
In the pg_upgrade test suite, don't write to src/test/regress.
When this suite runs installcheck, redirect file creations from src/test/regress to src/bin/pg_upgrade/tmp_check/regress. This closes a race condition in "make -j check-world". If the pg_upgrade suite wrote to a given src/test/regress/results file in parallel with the regular src/test/regress invocation writing it, a test failed spuriously. Even without parallelism, in "make -k check-world", the suite finishing second overwrote the other's regression.diffs. This revealed test "largeobject" assuming @abs_builddir@ is getcwd(), so fix that, too. Buildfarm client REL_10, released fifty-four days ago, supports saving regression.diffs from its new location. When an older client reports a pg_upgradeCheck failure, it will no longer include regression.diffs. Back-patch to 9.5, where pg_upgrade moved to src/bin. Reviewed (in earlier versions) by Andrew Dunstan. Discussion: https://postgr.es/m/20181224034411.GA3224776@rfd.leadboat.com
1 parent 10b72de commit 40b132c

File tree

5 files changed

+38
-12
lines changed

5 files changed

+38
-12
lines changed

src/bin/pg_upgrade/test.sh

+11
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,17 @@ BASE_PGDATA="$temp_root/data"
9696
PGDATA="${BASE_PGDATA}.old"
9797
export PGDATA
9898

99+
# Send installcheck outputs to a private directory. This avoids conflict when
100+
# check-world runs pg_upgrade check concurrently with src/test/regress check.
101+
# To retrieve interesting files after a run, use pattern tmp_check/*/*.diffs.
102+
outputdir="$temp_root/regress"
103+
EXTRA_REGRESS_OPTS="$EXTRA_REGRESS_OPTS --outputdir=$outputdir"
104+
export EXTRA_REGRESS_OPTS
105+
mkdir "$outputdir"
106+
mkdir "$outputdir"/sql
107+
mkdir "$outputdir"/expected
108+
mkdir "$outputdir"/testtablespace
109+
99110
logdir=`pwd`/log
100111
rm -rf "$logdir"
101112
mkdir "$logdir"

src/test/regress/input/largeobject.source

+3-3
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,12 @@ END;
203203

204204
SELECT lo_export(loid, '@abs_builddir@/results/lotest.txt') FROM lotest_stash_values;
205205

206-
\lo_import 'results/lotest.txt'
206+
\lo_import '@abs_builddir@/results/lotest.txt'
207207

208208
\set newloid :LASTOID
209209

210210
-- just make sure \lo_export does not barf
211-
\lo_export :newloid 'results/lotest2.txt'
211+
\lo_export :newloid '@abs_builddir@/results/lotest2.txt'
212212

213213
-- This is a hack to test that export/import are reversible
214214
-- This uses knowledge about the inner workings of large object mechanism
@@ -223,7 +223,7 @@ TRUNCATE lotest_stash_values;
223223

224224
\lo_unlink :newloid
225225

226-
\lo_import 'results/lotest.txt'
226+
\lo_import '@abs_builddir@/results/lotest.txt'
227227

228228
\set newloid_1 :LASTOID
229229

src/test/regress/output/largeobject.source

+3-3
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,10 @@ SELECT lo_export(loid, '@abs_builddir@/results/lotest.txt') FROM lotest_stash_va
385385
1
386386
(1 row)
387387

388-
\lo_import 'results/lotest.txt'
388+
\lo_import '@abs_builddir@/results/lotest.txt'
389389
\set newloid :LASTOID
390390
-- just make sure \lo_export does not barf
391-
\lo_export :newloid 'results/lotest2.txt'
391+
\lo_export :newloid '@abs_builddir@/results/lotest2.txt'
392392
-- This is a hack to test that export/import are reversible
393393
-- This uses knowledge about the inner workings of large object mechanism
394394
-- which should not be used outside it. This makes it a HACK
@@ -407,7 +407,7 @@ SELECT lo_unlink(loid) FROM lotest_stash_values;
407407

408408
TRUNCATE lotest_stash_values;
409409
\lo_unlink :newloid
410-
\lo_import 'results/lotest.txt'
410+
\lo_import '@abs_builddir@/results/lotest.txt'
411411
\set newloid_1 :LASTOID
412412
SELECT lo_from_bytea(0, lo_get(:newloid_1)) AS newloid_2
413413
\gset

src/test/regress/output/largeobject_1.source

+3-3
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,10 @@ SELECT lo_export(loid, '@abs_builddir@/results/lotest.txt') FROM lotest_stash_va
385385
1
386386
(1 row)
387387

388-
\lo_import 'results/lotest.txt'
388+
\lo_import '@abs_builddir@/results/lotest.txt'
389389
\set newloid :LASTOID
390390
-- just make sure \lo_export does not barf
391-
\lo_export :newloid 'results/lotest2.txt'
391+
\lo_export :newloid '@abs_builddir@/results/lotest2.txt'
392392
-- This is a hack to test that export/import are reversible
393393
-- This uses knowledge about the inner workings of large object mechanism
394394
-- which should not be used outside it. This makes it a HACK
@@ -407,7 +407,7 @@ SELECT lo_unlink(loid) FROM lotest_stash_values;
407407

408408
TRUNCATE lotest_stash_values;
409409
\lo_unlink :newloid
410-
\lo_import 'results/lotest.txt'
410+
\lo_import '@abs_builddir@/results/lotest.txt'
411411
\set newloid_1 :LASTOID
412412
SELECT lo_from_bytea(0, lo_get(:newloid_1)) AS newloid_2
413413
\gset

src/tools/msvc/vcregress.pl

+18-3
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@
9999

100100
########################################################################
101101

102-
sub installcheck
102+
sub installcheck_internal
103103
{
104-
my $schedule = shift || 'serial';
104+
my ($schedule, @EXTRA_REGRESS_OPTS) = @_;
105105
my @args = (
106106
"../../../$Config/pg_regress/pg_regress",
107107
"--dlpath=.",
@@ -111,12 +111,20 @@ sub installcheck
111111
"--encoding=SQL_ASCII",
112112
"--no-locale");
113113
push(@args, $maxconn) if $maxconn;
114+
push(@args, @EXTRA_REGRESS_OPTS);
114115
system(@args);
115116
my $status = $? >> 8;
116117
exit $status if $status;
117118
return;
118119
}
119120

121+
sub installcheck
122+
{
123+
my $schedule = shift || 'serial';
124+
installcheck_internal($schedule);
125+
return;
126+
}
127+
120128
sub check
121129
{
122130
my $schedule = shift || 'parallel';
@@ -559,6 +567,13 @@ sub upgradecheck
559567
$ENV{PATH} = "$bindir;$ENV{PATH}";
560568
my $data = "$tmp_root/data";
561569
$ENV{PGDATA} = "$data.old";
570+
my $outputdir = "$tmp_root/regress";
571+
my @EXTRA_REGRESS_OPTS = ("--outputdir=$outputdir");
572+
mkdir "$outputdir" || die $!;
573+
mkdir "$outputdir/sql" || die $!;
574+
mkdir "$outputdir/expected" || die $!;
575+
mkdir "$outputdir/testtablespace" || die $!;
576+
562577
my $logdir = "$topdir/src/bin/pg_upgrade/log";
563578
rmtree($logdir);
564579
mkdir $logdir || die $!;
@@ -574,7 +589,7 @@ sub upgradecheck
574589
generate_db('', 91, 127, '');
575590

576591
print "\nSetting up data for upgrading\n\n";
577-
installcheck('parallel');
592+
installcheck_internal('parallel', @EXTRA_REGRESS_OPTS);
578593

579594
# now we can chdir into the source dir
580595
chdir "$topdir/src/bin/pg_upgrade";

0 commit comments

Comments
 (0)