Commit e78900af authored by Michael Paquier's avatar Michael Paquier

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
parent 64725728
......@@ -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
......
......@@ -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
......
......@@ -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";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment