Skip to content

Commit 20103a2

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 329575d commit 20103a2

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
@@ -68,6 +68,8 @@ export PGHOST
6868

6969
# don't rely on $PWD here, as old shells don't set it
7070
temp_root=`pwd`/tmp_check
71+
rm -rf "$temp_root"
72+
mkdir "$temp_root"
7173

7274
if [ "$1" = '--install' ]; then
7375
temp_install=$temp_root/install
@@ -108,7 +110,6 @@ export PATH
108110
BASE_PGDATA="$temp_root/data"
109111
PGDATA="${BASE_PGDATA}.old"
110112
export PGDATA
111-
rm -rf "$BASE_PGDATA" "$PGDATA"
112113

113114
logdir=`pwd`/log
114115
rm -rf "$logdir"

src/tools/msvc/vcregress.pl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,8 @@ sub upgradecheck
534534
$ENV{PGHOST} = 'localhost';
535535
$ENV{PGPORT} ||= 50432;
536536
my $tmp_root = "$topdir/src/bin/pg_upgrade/tmp_check";
537-
(mkdir $tmp_root || die $!) unless -d $tmp_root;
537+
rmtree($tmp_root);
538+
mkdir $tmp_root || die $!;
538539
my $upg_tmp_install = "$tmp_root/install"; # unshared temp install
539540
print "Setting up temp install\n\n";
540541
Install($upg_tmp_install, "all", $config);
@@ -547,7 +548,8 @@ sub upgradecheck
547548
my $data = "$tmp_root/data";
548549
$ENV{PGDATA} = "$data.old";
549550
my $logdir = "$topdir/src/bin/pg_upgrade/log";
550-
(mkdir $logdir || die $!) unless -d $logdir;
551+
rmtree($logdir);
552+
mkdir $logdir || die $!;
551553
print "\nRunning initdb on old cluster\n\n";
552554
standard_initdb() or exit 1;
553555
print "\nStarting old cluster\n\n";

0 commit comments

Comments
 (0)