0001-Run-pg_upgrade-test-in-build-directory.patch

text/plain

Filename: 0001-Run-pg_upgrade-test-in-build-directory.patch
Type: text/plain
Part: 0
Message: pg_upgrade test writes to source directory

Patch

Format: format-patch
Series: patch 0001
Subject: Run pg_upgrade test in build directory
File+
src/bin/pg_upgrade/t/002_pg_upgrade.pl 9 5
From c064fc9a78f301d840cf608d2f5b997ad1d37a28 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Wed, 25 May 2022 08:18:44 +0200
Subject: [PATCH] Run pg_upgrade test in build directory

In passing, add names to tests that didn't have any yet.
---
 src/bin/pg_upgrade/t/002_pg_upgrade.pl | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index 75ac768a96..114e5fbcb6 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use Cwd qw(abs_path getcwd);
+use Cwd qw(abs_path);
 use File::Basename qw(dirname);
 use File::Compare;
 
@@ -10,6 +10,8 @@
 use PostgreSQL::Test::Utils;
 use Test::More;
 
+chdir $ENV{TESTOUTDIR};
+
 # Generate a database with a name made of a range of ASCII characters.
 sub generate_db
 {
@@ -23,7 +25,7 @@ sub generate_db
 	}
 
 	$dbname .= $suffix;
-	$node->command_ok([ 'createdb', $dbname ]);
+	$node->command_ok([ 'createdb', $dbname ], 'created database');
 }
 
 # The test of pg_upgrade requires two clusters, an old one and a new one
@@ -71,7 +73,7 @@ sub generate_db
 
 	# Load the dump using the "postgres" database as "regression" does
 	# not exist yet, and we are done here.
-	$oldnode->command_ok([ 'psql', '-X', '-f', $olddumpfile, 'postgres' ]);
+	$oldnode->command_ok([ 'psql', '-X', '-f', $olddumpfile, 'postgres' ], 'loaded old dump file');
 }
 else
 {
@@ -136,7 +138,8 @@ sub generate_db
 			'psql', '-X',
 			'-f', "$srcdir/src/bin/pg_upgrade/upgrade_adapt.sql",
 			'regression'
-		]);
+		],
+		'ran adapt script');
 }
 
 # Initialize a new node for the upgrade.
@@ -233,7 +236,8 @@ sub generate_db
 		'pg_dumpall', '--no-sync',
 		'-d',         $newnode->connstr('postgres'),
 		'-f',         "$tempdir/dump2.sql"
-	]);
+	],
+	'dump before running pg_upgrade');
 
 # Compare the two dumps, there should be no differences.
 my $compare_res = compare("$tempdir/dump1.sql", "$tempdir/dump2.sql");
-- 
2.36.1