pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: pg_upgrade test writes to source directory
Date: Wed, 25 May 2022 08:21:26 +0200
Message-ID: <f80ace33-11fb-1cd3-20f8-98f51d151088@enterprisedb.com> (raw)

The 002_pg_upgrade.pl test leaves a file delete_old_cluster.sh in the 
source directory.  In vpath builds, there shouldn't be any files written 
to the source directory.

Note that the TAP tests run with the source directory as the current 
directory, so this is the result of pg_upgrade leaving its output files 
in the current directory.

It looks like an addition of

     chdir $ENV{TESTOUTDIR};

could fix it.  Please check the patch.

Attachments:

0001-Run-pg_upgrade-test-in-build-directory.patch (text/plain, 2.0K) download 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

view thread (31+ messages)  latest in thread

Message-ID: <f80ace33-11fb-1cd3-20f8-98f51d151088@enterprisedb.com>
Permalink:  ../f80ace33-11fb-1cd3-20f8-98f51d151088@enterprisedb.com/
Also on:    postgresql.org/message-id/f80ace33-11fb-1cd3-20f8-98f51d151088@enterprisedb.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@enterprisedb.com, michael@paquier.xyz
  Subject: Re: pg_upgrade test writes to source directory
  In-Reply-To: <f80ace33-11fb-1cd3-20f8-98f51d151088@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox