diff options
author | Michael Paquier <michael@paquier.xyz> | 2020-07-10 17:08:13 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2020-07-10 17:08:13 +0900 |
commit | 61be85afabba0cd85bb1bcaacbea8efa8641f564 (patch) | |
tree | f2cbe99786ea878caade6ec4421ed02c45ed7113 /src | |
parent | ff61359ad7cd10e48a9ce662b5f2a5e7f3ca23e1 (diff) | |
download | postgresql-61be85afabba0cd85bb1bcaacbea8efa8641f564.tar.gz postgresql-61be85afabba0cd85bb1bcaacbea8efa8641f564.zip |
Revert "Remove reset of testtablespace from pg_regress on Windows"
This reverts commit 2b2a070, that moved the reset of path
"testtablespace" used by the regression tests as a path for tablespaces
(via --outputdir) from pg_regress to the MSVC script vcregress.pl, as
this broke the behavior added by ce5d342 to be able to safely run the
regression test suite with an administrative Windows account using a
restricted token.
Note that before 2b2a070, the code doing the reset in pg_regress.c
included a comment telling that we had better move that out to a
different place, leading to the mistake done in 2b2a070. Fix this
comment, and document instead that we had better never remove this code,
for the sake of not breaking again the behavior we expect on Windows.
Thanks to Thomas Munro and Andrew Dunstan for the discussion.
Discussion: https://postgr.es/m/6d9eee97-54c8-e14a-48f7-3194e712f54f@2ndQuadrant.com
Discussion: https://postgr.es/m/CA+hUKGLiieEzfrdWxWFE+_wnXho_F5Smx972X1wEubhS7v1q9g@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r-- | src/test/regress/pg_regress.c | 19 | ||||
-rw-r--r-- | src/tools/msvc/vcregress.pl | 17 |
2 files changed, 21 insertions, 15 deletions
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index c8d190d2489..d82e0189dcf 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -494,6 +494,25 @@ convert_sourcefiles_in(const char *source_subdir, const char *dest_dir, const ch snprintf(testtablespace, MAXPGPATH, "%s/testtablespace", outputdir); +#ifdef WIN32 + + /* + * On Windows only, clean out the test tablespace dir, or create it if it + * doesn't exist so as it is possible to run the regression tests as a + * Windows administrative user account with the restricted token obtained + * when starting pg_regress. On other platforms we expect the Makefile to + * take care of that. + */ + if (directory_exists(testtablespace)) + if (!rmtree(testtablespace, true)) + { + fprintf(stderr, _("\n%s: could not remove test tablespace \"%s\"\n"), + progname, testtablespace); + exit(2); + } + make_directory(testtablespace); +#endif + /* finally loop on each file and do the replacement */ for (name = names; *name; name++) { diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index d6763ad4ac5..3365ee578c3 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -123,8 +123,6 @@ sub installcheck_internal sub installcheck { my $schedule = shift || 'serial'; - - CleanupTablespaceDirectory(); installcheck_internal($schedule); return; } @@ -145,7 +143,6 @@ sub check "--temp-instance=./tmp_check"); push(@args, $maxconn) if $maxconn; push(@args, $temp_config) if $temp_config; - CleanupTablespaceDirectory(); system(@args); my $status = $? >> 8; exit $status if $status; @@ -573,8 +570,8 @@ sub upgradecheck $ENV{PGDATA} = "$data.old"; my $outputdir = "$tmp_root/regress"; my @EXTRA_REGRESS_OPTS = ("--outputdir=$outputdir"); - mkdir "$outputdir" || die $!; - CleanupTablespaceDirectory($outputdir); + mkdir "$outputdir" || die $!; + mkdir "$outputdir/testtablespace" || die $!; my $logdir = "$topdir/src/bin/pg_upgrade/log"; rmtree($logdir); @@ -740,16 +737,6 @@ sub InstallTemp return; } -sub CleanupTablespaceDirectory -{ - my $testdir = shift || getcwd(); - - my $testtablespace = "$testdir/testtablespace"; - - rmtree($testtablespace) if (-d $testtablespace); - mkdir($testtablespace); -} - sub usage { print STDERR |