Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6c788d9

Browse files
committed
Move tablespace path re-creation from the makefiles to pg_regress
Moving this logic into pg_regress fixes a potential failure with parallel tests when pg_upgrade and the main regression test suite both trigger the makefile rule that cleaned up testtablespace/ under src/test/regress. Even if pg_upgrade was triggering this rule, it has no need to do so as it uses a different tablespace path. So if pg_upgrade triggered the makefile rule for the tablespace setup while the main regression test suite ran the tablespace cases, it would fail. 61be85a was a similar attempt at achieving that, but that broke cases where the regression tests require to run under an Administrator account, like with Appveyor. Reported-by: Andres Freund, Kyotaro Horiguchi Reviewed-by: Peter Eisentraut Discussion: https://postgr.es/m/[email protected]
1 parent aeb57af commit 6c788d9

File tree

4 files changed

+13
-24
lines changed

4 files changed

+13
-24
lines changed

src/bin/pg_upgrade/test.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ outputdir="$temp_root/regress"
106106
EXTRA_REGRESS_OPTS="$EXTRA_REGRESS_OPTS --outputdir=$outputdir"
107107
export EXTRA_REGRESS_OPTS
108108
mkdir "$outputdir"
109-
mkdir "$outputdir"/testtablespace
110109

111110
logdir=`pwd`/log
112111
rm -rf "$logdir"

src/test/regress/GNUmakefile

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -114,33 +114,26 @@ submake-contrib-spi: | submake-libpgport submake-generated-headers
114114

115115
.PHONY: submake-contrib-spi
116116

117-
# Tablespace setup
118-
119-
.PHONY: tablespace-setup
120-
tablespace-setup:
121-
rm -rf ./testtablespace
122-
mkdir ./testtablespace
123-
124117

125118
##
126119
## Run tests
127120
##
128121

129122
REGRESS_OPTS = --dlpath=. --max-concurrent-tests=20 $(EXTRA_REGRESS_OPTS)
130123

131-
check: all tablespace-setup
124+
check: all
132125
$(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS)
133126

134-
check-tests: all tablespace-setup | temp-install
127+
check-tests: all | temp-install
135128
$(pg_regress_check) $(REGRESS_OPTS) $(MAXCONNOPT) $(TESTS) $(EXTRA_TESTS)
136129

137-
installcheck: all tablespace-setup
130+
installcheck: all
138131
$(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule $(EXTRA_TESTS)
139132

140-
installcheck-parallel: all tablespace-setup
133+
installcheck-parallel: all
141134
$(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS)
142135

143-
installcheck-tests: all tablespace-setup
136+
installcheck-tests: all
144137
$(pg_regress_installcheck) $(REGRESS_OPTS) $(TESTS) $(EXTRA_TESTS)
145138

146139
standbycheck: all
@@ -152,10 +145,10 @@ runcheck: check
152145
runtest: installcheck
153146
runtest-parallel: installcheck-parallel
154147

155-
bigtest: all tablespace-setup
148+
bigtest: all
156149
$(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule numeric_big
157150

158-
bigcheck: all tablespace-setup | temp-install
151+
bigcheck: all | temp-install
159152
$(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) numeric_big
160153

161154

src/test/regress/pg_regress.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -506,24 +506,22 @@ convert_sourcefiles_in(const char *source_subdir, const char *dest_dir, const ch
506506

507507
snprintf(testtablespace, MAXPGPATH, "%s/testtablespace", outputdir);
508508

509-
#ifdef WIN32
510-
511509
/*
512-
* On Windows only, clean out the test tablespace dir, or create it if it
513-
* doesn't exist so as it is possible to run the regression tests as a
514-
* Windows administrative user account with the restricted token obtained
515-
* when starting pg_regress. On other platforms we expect the Makefile to
516-
* take care of that.
510+
* Clean out the test tablespace dir, or create it if it doesn't exist. On
511+
* Windows, doing this cleanup here makes possible to run the regression
512+
* tests as a Windows administrative user account with the restricted
513+
* token obtained when starting pg_regress.
517514
*/
518515
if (directory_exists(testtablespace))
516+
{
519517
if (!rmtree(testtablespace, true))
520518
{
521519
fprintf(stderr, _("\n%s: could not remove test tablespace \"%s\"\n"),
522520
progname, testtablespace);
523521
exit(2);
524522
}
523+
}
525524
make_directory(testtablespace);
526-
#endif
527525

528526
/* finally loop on each file and do the replacement */
529527
for (name = names; *name; name++)

src/tools/msvc/vcregress.pl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,6 @@ sub upgradecheck
585585
my $outputdir = "$tmp_root/regress";
586586
my @EXTRA_REGRESS_OPTS = ("--outputdir=$outputdir");
587587
mkdir "$outputdir" || die $!;
588-
mkdir "$outputdir/testtablespace" || die $!;
589588

590589
my $logdir = "$topdir/src/bin/pg_upgrade/log";
591590
rmtree($logdir);

0 commit comments

Comments
 (0)