Commit 6c788d9f authored by Michael Paquier's avatar Michael Paquier

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.

61be85af 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/20201209012911.uk4d6nxcnkp7ehrx@alap3.anarazel.de
parent aeb57af8
...@@ -106,7 +106,6 @@ outputdir="$temp_root/regress" ...@@ -106,7 +106,6 @@ outputdir="$temp_root/regress"
EXTRA_REGRESS_OPTS="$EXTRA_REGRESS_OPTS --outputdir=$outputdir" EXTRA_REGRESS_OPTS="$EXTRA_REGRESS_OPTS --outputdir=$outputdir"
export EXTRA_REGRESS_OPTS export EXTRA_REGRESS_OPTS
mkdir "$outputdir" mkdir "$outputdir"
mkdir "$outputdir"/testtablespace
logdir=`pwd`/log logdir=`pwd`/log
rm -rf "$logdir" rm -rf "$logdir"
......
...@@ -114,13 +114,6 @@ submake-contrib-spi: | submake-libpgport submake-generated-headers ...@@ -114,13 +114,6 @@ submake-contrib-spi: | submake-libpgport submake-generated-headers
.PHONY: submake-contrib-spi .PHONY: submake-contrib-spi
# Tablespace setup
.PHONY: tablespace-setup
tablespace-setup:
rm -rf ./testtablespace
mkdir ./testtablespace
## ##
## Run tests ## Run tests
...@@ -128,19 +121,19 @@ tablespace-setup: ...@@ -128,19 +121,19 @@ tablespace-setup:
REGRESS_OPTS = --dlpath=. --max-concurrent-tests=20 $(EXTRA_REGRESS_OPTS) REGRESS_OPTS = --dlpath=. --max-concurrent-tests=20 $(EXTRA_REGRESS_OPTS)
check: all tablespace-setup check: all
$(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS) $(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS)
check-tests: all tablespace-setup | temp-install check-tests: all | temp-install
$(pg_regress_check) $(REGRESS_OPTS) $(MAXCONNOPT) $(TESTS) $(EXTRA_TESTS) $(pg_regress_check) $(REGRESS_OPTS) $(MAXCONNOPT) $(TESTS) $(EXTRA_TESTS)
installcheck: all tablespace-setup installcheck: all
$(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule $(EXTRA_TESTS) $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule $(EXTRA_TESTS)
installcheck-parallel: all tablespace-setup installcheck-parallel: all
$(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS) $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS)
installcheck-tests: all tablespace-setup installcheck-tests: all
$(pg_regress_installcheck) $(REGRESS_OPTS) $(TESTS) $(EXTRA_TESTS) $(pg_regress_installcheck) $(REGRESS_OPTS) $(TESTS) $(EXTRA_TESTS)
standbycheck: all standbycheck: all
...@@ -152,10 +145,10 @@ runcheck: check ...@@ -152,10 +145,10 @@ runcheck: check
runtest: installcheck runtest: installcheck
runtest-parallel: installcheck-parallel runtest-parallel: installcheck-parallel
bigtest: all tablespace-setup bigtest: all
$(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule numeric_big $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule numeric_big
bigcheck: all tablespace-setup | temp-install bigcheck: all | temp-install
$(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) numeric_big $(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) numeric_big
......
...@@ -506,24 +506,22 @@ convert_sourcefiles_in(const char *source_subdir, const char *dest_dir, const ch ...@@ -506,24 +506,22 @@ convert_sourcefiles_in(const char *source_subdir, const char *dest_dir, const ch
snprintf(testtablespace, MAXPGPATH, "%s/testtablespace", outputdir); snprintf(testtablespace, MAXPGPATH, "%s/testtablespace", outputdir);
#ifdef WIN32
/* /*
* On Windows only, clean out the test tablespace dir, or create it if it * Clean out the test tablespace dir, or create it if it doesn't exist. On
* doesn't exist so as it is possible to run the regression tests as a * Windows, doing this cleanup here makes possible to run the regression
* Windows administrative user account with the restricted token obtained * tests as a Windows administrative user account with the restricted
* when starting pg_regress. On other platforms we expect the Makefile to * token obtained when starting pg_regress.
* take care of that.
*/ */
if (directory_exists(testtablespace)) if (directory_exists(testtablespace))
{
if (!rmtree(testtablespace, true)) if (!rmtree(testtablespace, true))
{ {
fprintf(stderr, _("\n%s: could not remove test tablespace \"%s\"\n"), fprintf(stderr, _("\n%s: could not remove test tablespace \"%s\"\n"),
progname, testtablespace); progname, testtablespace);
exit(2); exit(2);
} }
}
make_directory(testtablespace); make_directory(testtablespace);
#endif
/* finally loop on each file and do the replacement */ /* finally loop on each file and do the replacement */
for (name = names; *name; name++) for (name = names; *name; name++)
......
...@@ -585,7 +585,6 @@ sub upgradecheck ...@@ -585,7 +585,6 @@ sub upgradecheck
my $outputdir = "$tmp_root/regress"; my $outputdir = "$tmp_root/regress";
my @EXTRA_REGRESS_OPTS = ("--outputdir=$outputdir"); my @EXTRA_REGRESS_OPTS = ("--outputdir=$outputdir");
mkdir "$outputdir" || die $!; mkdir "$outputdir" || die $!;
mkdir "$outputdir/testtablespace" || die $!;
my $logdir = "$topdir/src/bin/pg_upgrade/log"; my $logdir = "$topdir/src/bin/pg_upgrade/log";
rmtree($logdir); rmtree($logdir);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment