Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e78900a

Browse files
committed
Create by default sql/ and expected/ for output directory in pg_regress
Using --outputdir with a custom output repository has never created by default the sql/ and expected/ paths generated with contents from respectively input/ and output/ if they don't exist, while the base output directory gets created if it does not exist. If sql/ and expected/ are not present, pg_regress would fail with the path missing, requiring test scripts to create those extra paths by themselves. This commit changes pg_regress so as both get created by default if they do not exist, removing the need for external test scripts to do so. This cleans up two code paths in the tree for pg_upgrade tests in MSVC and environments able to use test.sh. sql/ and expected/ were created as part of each test script, but this is not needed anymore as pg_regress handles the work now. Author: Roman Zharkov, Daniel Gustafsson Reviewed-by: Michael Paquier, Tom Lane Discussion: https://postgr.es/m/16484-4d89e9cc11241996@postgresql.org
1 parent 6472572 commit e78900a

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/bin/pg_upgrade/test.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ outputdir="$temp_root/regress"
106106
EXTRA_REGRESS_OPTS="$EXTRA_REGRESS_OPTS --outputdir=$outputdir"
107107
export EXTRA_REGRESS_OPTS
108108
mkdir "$outputdir"
109-
mkdir "$outputdir"/sql
110-
mkdir "$outputdir"/expected
111109
mkdir "$outputdir"/testtablespace
112110

113111
logdir=`pwd`/log

src/test/regress/pg_regress.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,17 +465,15 @@ convert_sourcefiles_in(const char *source_subdir, const char *dest_dir, const ch
465465
{
466466
char testtablespace[MAXPGPATH];
467467
char indir[MAXPGPATH];
468-
struct stat st;
469-
int ret;
468+
char outdir_sub[MAXPGPATH];
470469
char **name;
471470
char **names;
472471
int count = 0;
473472

474473
snprintf(indir, MAXPGPATH, "%s/%s", inputdir, source_subdir);
475474

476475
/* Check that indir actually exists and is a directory */
477-
ret = stat(indir, &st);
478-
if (ret != 0 || !S_ISDIR(st.st_mode))
476+
if (!directory_exists(indir))
479477
{
480478
/*
481479
* No warning, to avoid noise in tests that do not have these
@@ -489,6 +487,11 @@ convert_sourcefiles_in(const char *source_subdir, const char *dest_dir, const ch
489487
/* Error logged in pgfnames */
490488
exit(2);
491489

490+
/* Create the "dest" subdirectory if not present */
491+
snprintf(outdir_sub, MAXPGPATH, "%s/%s", dest_dir, dest_subdir);
492+
if (!directory_exists(outdir_sub))
493+
make_directory(outdir_sub);
494+
492495
snprintf(testtablespace, MAXPGPATH, "%s/testtablespace", outputdir);
493496

494497
#ifdef WIN32

src/tools/msvc/vcregress.pl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,6 @@ sub upgradecheck
571571
my $outputdir = "$tmp_root/regress";
572572
my @EXTRA_REGRESS_OPTS = ("--outputdir=$outputdir");
573573
mkdir "$outputdir" || die $!;
574-
mkdir "$outputdir/sql" || die $!;
575-
mkdir "$outputdir/expected" || die $!;
576574
mkdir "$outputdir/testtablespace" || die $!;
577575

578576
my $logdir = "$topdir/src/bin/pg_upgrade/log";

0 commit comments

Comments
 (0)