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++)
{
sub installcheck
{
my $schedule = shift || 'serial';
-
- CleanupTablespaceDirectory();
installcheck_internal($schedule);
return;
}
"--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;
$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);
return;
}
-sub CleanupTablespaceDirectory
-{
- my $testdir = shift || getcwd();
-
- my $testtablespace = "$testdir/testtablespace";
-
- rmtree($testtablespace) if (-d $testtablespace);
- mkdir($testtablespace);
-}
-
sub usage
{
print STDERR