aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2020-06-13 14:04:56 +0900
committerMichael Paquier <michael@paquier.xyz>2020-06-13 14:04:56 +0900
commite78900afd217fa3eaa77c51e23a94c1466af421c (patch)
treec32c34684aa992697933e2f5f171530cf013ce40 /src
parent64725728e790b76c97984b1029d9ffe90bcb2ec4 (diff)
downloadpostgresql-e78900afd217fa3eaa77c51e23a94c1466af421c.tar.gz
postgresql-e78900afd217fa3eaa77c51e23a94c1466af421c.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_upgrade/test.sh2
-rw-r--r--src/test/regress/pg_regress.c11
-rw-r--r--src/tools/msvc/vcregress.pl2
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";