Skip to content

Commit 8e2b41e

Browse files
committed
In the pg_upgrade test suite, remove and recreate "tmp_check".
This allows "vcregress upgradecheck" to pass twice in immediate succession, and it's more like how $(prove_check) works. Back-patch to 9.5, where pg_upgrade moved to src/bin. Discussion: https://postgr.es/m/20190520012436.GA1480421@rfd.leadboat.com
1 parent 9ba3915 commit 8e2b41e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/bin/pg_upgrade/test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ export PGHOST
6666

6767
# don't rely on $PWD here, as old shells don't set it
6868
temp_root=`pwd`/tmp_check
69+
rm -rf "$temp_root"
70+
mkdir "$temp_root"
6971

7072
if [ "$1" = '--install' ]; then
7173
temp_install=$temp_root/install
@@ -106,7 +108,6 @@ export PATH
106108
BASE_PGDATA=$temp_root/data
107109
PGDATA="$BASE_PGDATA.old"
108110
export PGDATA
109-
rm -rf "$BASE_PGDATA" "$PGDATA"
110111

111112
logdir=`pwd`/log
112113
rm -rf "$logdir"

src/tools/msvc/vcregress.pl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,8 @@ sub upgradecheck
501501
$ENV{PGHOST} = 'localhost';
502502
$ENV{PGPORT} ||= 50432;
503503
my $tmp_root = "$topdir/src/bin/pg_upgrade/tmp_check";
504-
(mkdir $tmp_root || die $!) unless -d $tmp_root;
504+
rmtree($tmp_root);
505+
mkdir $tmp_root || die $!;
505506
my $upg_tmp_install = "$tmp_root/install"; # unshared temp install
506507
print "Setting up temp install\n\n";
507508
Install($upg_tmp_install, "all", $config);
@@ -514,7 +515,8 @@ sub upgradecheck
514515
my $data = "$tmp_root/data";
515516
$ENV{PGDATA} = "$data.old";
516517
my $logdir = "$topdir/src/bin/pg_upgrade/log";
517-
(mkdir $logdir || die $!) unless -d $logdir;
518+
rmtree($logdir);
519+
mkdir $logdir || die $!;
518520
print "\nRunning initdb on old cluster\n\n";
519521
standard_initdb() or exit 1;
520522
print "\nStarting old cluster\n\n";

0 commit comments

Comments
 (0)