]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
In the pg_upgrade test suite, remove and recreate "tmp_check".
authorNoah Misch <noah@leadboat.com>
Tue, 28 May 2019 19:58:30 +0000 (12:58 -0700)
committerNoah Misch <noah@leadboat.com>
Tue, 28 May 2019 19:58:34 +0000 (12:58 -0700)
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

src/bin/pg_upgrade/test.sh
src/tools/msvc/vcregress.pl

index 400deb9b54ce6448140781652b0ab2dba0a13afe..7bfd2e13469666ca0061ac807e95d59ca5d9e500 100644 (file)
@@ -68,6 +68,8 @@ export PGHOST
 
 # don't rely on $PWD here, as old shells don't set it
 temp_root=`pwd`/tmp_check
+rm -rf "$temp_root"
+mkdir "$temp_root"
 
 if [ "$1" = '--install' ]; then
        temp_install=$temp_root/install
@@ -108,7 +110,6 @@ export PATH
 BASE_PGDATA="$temp_root/data"
 PGDATA="${BASE_PGDATA}.old"
 export PGDATA
-rm -rf "$BASE_PGDATA" "$PGDATA"
 
 logdir=`pwd`/log
 rm -rf "$logdir"
index 3e3a0587946bd1b2d72c2e078f025006d63a7c10..ba6ac9bb30f5505127b9dabd295623280ba40085 100644 (file)
@@ -534,7 +534,8 @@ sub upgradecheck
        $ENV{PGHOST} = 'localhost';
        $ENV{PGPORT} ||= 50432;
        my $tmp_root = "$topdir/src/bin/pg_upgrade/tmp_check";
-       (mkdir $tmp_root || die $!) unless -d $tmp_root;
+       rmtree($tmp_root);
+       mkdir $tmp_root || die $!;
        my $upg_tmp_install = "$tmp_root/install";    # unshared temp install
        print "Setting up temp install\n\n";
        Install($upg_tmp_install, "all", $config);
@@ -547,7 +548,8 @@ sub upgradecheck
        my $data = "$tmp_root/data";
        $ENV{PGDATA} = "$data.old";
        my $logdir = "$topdir/src/bin/pg_upgrade/log";
-       (mkdir $logdir || die $!) unless -d $logdir;
+       rmtree($logdir);
+       mkdir $logdir || die $!;
        print "\nRunning initdb on old cluster\n\n";
        standard_initdb() or exit 1;
        print "\nStarting old cluster\n\n";