postgres.git / summary / log / commit / refs
commit e78900afd217fa3eaa77c51e23a94c1466af421c
Author: Michael Paquier <michael@paquier.xyz>
Date: Sat Jun 13 05:04:56 2020 +0000
First released in: 14.0
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
src/bin/pg_upgrade/test.sh | 2 --
src/test/regress/pg_regress.c | 11 +++++++----
src/tools/msvc/vcregress.pl | 2 --
3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/bin/pg_upgrade/test.sh b/src/bin/pg_upgrade/test.sh
index 10a28d8133c..7ff06de6d18 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 38b2b1e8e1b..f11a3b9e26e 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -465,8 +465,7 @@ 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 outdir_sub[MAXPGPATH];
char **name;
char **names;
int count = 0;
@@ -474,8 +473,7 @@ convert_sourcefiles_in(const char *source_subdir, const char *dest_dir, const ch
snprintf(indir, MAXPGPATH, "%s/%s", inputdir, source_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
@@ -489,6 +487,11 @@ convert_sourcefiles_in(const char *source_subdir, const char *dest_dir, const ch
/* Error logged in pgfnames */
exit(2);
+ /* Create the "dest" subdirectory if not present */
+ snprintf(outdir_sub, MAXPGPATH, "%s/%s", dest_dir, dest_subdir);
+ if (!directory_exists(outdir_sub))
+ make_directory(outdir_sub);
+
snprintf(testtablespace, MAXPGPATH, "%s/testtablespace", outputdir);
#ifdef WIN32
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index 4a53a004b78..3365ee578c3 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";
[parent: 64725728e790]