Skip to content

Commit 2b2a070

Browse files
committed
Remove reset of testtablespace from pg_regress on Windows
testtablespace is an extra path used as tablespace location in the main regression test suite, computed from --outputdir as defined by the caller of pg_regress (current directory if undefined). This special handling was introduced as of f10589e to be specific to MSVC, as we let pg_regress' Makefile handle this cleanup in other environments. This moves the cleanup to the MSVC script running regression tests instead where needed: check, installcheck and upgradecheck. I have also checked this patch on MSVC with repeated runs of each target. Author: Kyotaro Horiguchi, Michael Paquier Discussion: https://postgr.es/m/20200219.142519.437573253063431435.horikyota.ntt@gmail.com
1 parent d8b15ee commit 2b2a070

File tree

2 files changed

+15
-24
lines changed

2 files changed

+15
-24
lines changed

src/test/regress/pg_regress.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -494,28 +494,6 @@ convert_sourcefiles_in(const char *source_subdir, const char *dest_dir, const ch
494494

495495
snprintf(testtablespace, MAXPGPATH, "%s/testtablespace", outputdir);
496496

497-
#ifdef WIN32
498-
499-
/*
500-
* On Windows only, clean out the test tablespace dir, or create it if it
501-
* doesn't exist. On other platforms we expect the Makefile to take care
502-
* of that. (We don't migrate that functionality in here because it'd be
503-
* harder to cope with platform-specific issues such as SELinux.)
504-
*
505-
* XXX it would be better if pg_regress.c had nothing at all to do with
506-
* testtablespace, and this were handled by a .BAT file or similar on
507-
* Windows. See pgsql-hackers discussion of 2008-01-18.
508-
*/
509-
if (directory_exists(testtablespace))
510-
if (!rmtree(testtablespace, true))
511-
{
512-
fprintf(stderr, _("\n%s: could not remove test tablespace \"%s\"\n"),
513-
progname, testtablespace);
514-
exit(2);
515-
}
516-
make_directory(testtablespace);
517-
#endif
518-
519497
/* finally loop on each file and do the replacement */
520498
for (name = names; *name; name++)
521499
{

src/tools/msvc/vcregress.pl

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ sub installcheck_internal
123123
sub installcheck
124124
{
125125
my $schedule = shift || 'serial';
126+
127+
CleanupTablespaceDirectory();
126128
installcheck_internal($schedule);
127129
return;
128130
}
@@ -143,6 +145,7 @@ sub check
143145
"--temp-instance=./tmp_check");
144146
push(@args, $maxconn) if $maxconn;
145147
push(@args, $temp_config) if $temp_config;
148+
CleanupTablespaceDirectory();
146149
system(@args);
147150
my $status = $? >> 8;
148151
exit $status if $status;
@@ -570,8 +573,8 @@ sub upgradecheck
570573
$ENV{PGDATA} = "$data.old";
571574
my $outputdir = "$tmp_root/regress";
572575
my @EXTRA_REGRESS_OPTS = ("--outputdir=$outputdir");
573-
mkdir "$outputdir" || die $!;
574-
mkdir "$outputdir/testtablespace" || die $!;
576+
mkdir "$outputdir" || die $!;
577+
CleanupTablespaceDirectory($outputdir);
575578

576579
my $logdir = "$topdir/src/bin/pg_upgrade/log";
577580
rmtree($logdir);
@@ -737,6 +740,16 @@ sub InstallTemp
737740
return;
738741
}
739742

743+
sub CleanupTablespaceDirectory
744+
{
745+
my $testdir = shift || getcwd();
746+
747+
my $testtablespace = "$testdir/testtablespace";
748+
749+
rmtree($testtablespace) if (-d $testtablespace);
750+
mkdir($testtablespace);
751+
}
752+
740753
sub usage
741754
{
742755
print STDERR

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy