pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: r.zharkov@postgrespro.ru
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16484: pg_regress fails with --outputdir parameter
Date: Tue, 9 Jun 2020 14:33:56 +0900
Message-ID: <20200609053356.GC38342@paquier.xyz> (raw)
In-Reply-To: <153B2C23-E972-4D2B-BBD3-EA77AEB79329@yesql.se>
References: <16484-4d89e9cc11241996@postgresql.org>
	<153B2C23-E972-4D2B-BBD3-EA77AEB79329@yesql.se>

On Mon, Jun 08, 2020 at 11:09:42AM +0200, Daniel Gustafsson wrote:
> Nice catch, testing the attached patch does indeed make pg_regress run without
> errors if outputdir doesn't exist.

No objections to that.  That seems more useful than having to recreate
them before running any custom script specifying --outputdir.

> While looking at it though, I noticed that we nearby use stat() in a single
> place while the rest use check_directory().  Is there a reason to not use
> check_directory consistently as per the attached diff?

Indeed.  And two extra things are that you can just simplify
src/bin/pg_upgrade/test.sh and src/tools/msvc/vcregress.pl so as they
don't create manually those repositories.  This report is not really
annoying for the average user in my opinion, so there may be little
point in backpatching this stuff.

And this leads me to the attached.
--
Michael

Attachments:

pg_regress_stat_v3.diff (text/x-diff, 1.9K) download diff --git a/src/bin/pg_upgrade/test.sh b/src/bin/pg_upgrade/test.sh index 10a28d8133..7ff06de6d1 100644 --- a/src/bin/pg_upgrade/test.sh +++ b/src/bin/pg_upgrade/test.sh @@ -106,8 +106,6 @@ outputdir="$temp_root/regress" EXTRA_REGRESS_OPTS="$EXTRA_REGRESS_OPTS --outputdir=$outputdir" export EXTRA_REGRESS_OPTS mkdir "$outputdir" -mkdir "$outputdir"/sql -mkdir "$outputdir"/expected mkdir "$outputdir"/testtablespace logdir=`pwd`/log diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index 38b2b1e8e1..b29de5edd3 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -465,17 +465,20 @@ convert_sourcefiles_in(const char *source_subdir, const char *dest_dir, const ch { char testtablespace[MAXPGPATH]; char indir[MAXPGPATH]; - struct stat st; - int ret; + char test_subdir[MAXPGPATH]; char **name; char **names; int count = 0; snprintf(indir, MAXPGPATH, "%s/%s", inputdir, source_subdir); + /* Create dest_subdir directory if it not exists */ + snprintf(test_subdir, MAXPGPATH, "%s/%s", dest_dir, dest_subdir); + if (!directory_exists(test_subdir)) + make_directory(test_subdir); + /* Check that indir actually exists and is a directory */ - ret = stat(indir, &st); - if (ret != 0 || !S_ISDIR(st.st_mode)) + if (!directory_exists(indir)) { /* * No warning, to avoid noise in tests that do not have these diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index 4a53a004b7..3365ee578c 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -571,8 +571,6 @@ sub upgradecheck my $outputdir = "$tmp_root/regress"; my @EXTRA_REGRESS_OPTS = ("--outputdir=$outputdir"); mkdir "$outputdir" || die $!; - mkdir "$outputdir/sql" || die $!; - mkdir "$outputdir/expected" || die $!; mkdir "$outputdir/testtablespace" || die $!; my $logdir = "$topdir/src/bin/pg_upgrade/log";
signature.asc (application/pgp-signature, 832B) download

view thread (8+ messages)  latest in thread

Message-ID: <20200609053356.GC38342@paquier.xyz>
Permalink:  ../20200609053356.GC38342@paquier.xyz/
Also on:    postgresql.org/message-id/20200609053356.GC38342@paquier.xyz

 ·  · 

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-bugs@postgresql.org
  Cc: michael@paquier.xyz, daniel@yesql.se, r.zharkov@postgrespro.ru, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16484: pg_regress fails with --outputdir parameter
  In-Reply-To: <20200609053356.GC38342@paquier.xyz>

* 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