From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: r.zharkov@postgrespro.ru
Subject: BUG #16484: pg_regress fails with --outputdir parameter
Date: Mon, 08 Jun 2020 05:45:30 +0000
Message-ID: <16484-4d89e9cc11241996@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 16484
Logged by: Roman Zharkov
Email address: r.zharkov@postgrespro.ru
PostgreSQL version: 13beta1
Operating system: linux, windows
Description:
Hello,
pg_regress fails when i try to change the output directory with
"--outputdir" parameter.
This happens bacause pg_regress creates the output directory, but doesn't
create sql and expected subdirectories.
Here is an example:
$ ./pg_regress int8 --dlpath=.
(using postmaster on Unix socket, default port)
============== dropping database "regression" ==============
DROP DATABASE
============== creating database "regression" ==============
CREATE DATABASE
ALTER DATABASE
============== running regression test queries ==============
test int8 ... ok 122 ms
=====================
All 1 tests passed.
=====================
$ ./pg_regress int8 --dlpath=. --outputdir=~regress_output
(using postmaster on Unix socket, default port)
pg_regress: could not open file "~regress_output/sql/largeobject.sql" for
writing: Нет такого файла или каталога
$ mkdir ~regress_output/sql
$ ./pg_regress int8 --dlpath=. --outputdir=~regress_output
(using postmaster on Unix socket, default port)
pg_regress: could not open file
"~regress_output/expected/create_function_2.out" for writing: Нет такого
файла или каталога
$ mkdir ~regress_output/expected
$ ./pg_regress int8 --dlpath=. --outputdir=~regress_output
(using postmaster on Unix socket, default port)
============== dropping database "regression" ==============
DROP DATABASE
============== creating database "regression" ==============
CREATE DATABASE
ALTER DATABASE
============== running regression test queries ==============
test int8 ... ok 174 ms
=====================
All 1 tests passed.
=====================
This patch can fix the issue:
inline patch 1: src/test/regress/pg_regress.c (+0/-0 lines) download inline-1.patchdiff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.cindex 38b2b1e8e1b..1eb1122d237 100644--- a/src/test/regress/pg_regress.c+++ b/src/test/regress/pg_regress.c@@ -465,6 +465,7 @@ convert_sourcefiles_in(const char *source_subdir, constchar *dest_dir, const ch
{
char testtablespace[MAXPGPATH];
char indir[MAXPGPATH];
+ char output_subdir[MAXPGPATH];
struct stat st;
int ret;
char **name;
@@ -473,6 +474,11 @@ convert_sourcefiles_in(const char *source_subdir, const
char *dest_dir, const ch
snprintf(indir, MAXPGPATH, "%s/%s", inputdir, source_subdir);
+ /* Create dest_subdir directory if it not exists */
+ snprintf(output_subdir, MAXPGPATH, "%s/%s", dest_dir, dest_subdir);
+ if (!directory_exists(output_subdir))
+ make_directory(output_subdir);
+
/* Check that indir actually exists and is a directory */
ret = stat(indir, &st);
if (ret != 0 || !S_ISDIR(st.st_mode))
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: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, r.zharkov@postgrespro.ru
Subject: Re: BUG #16484: pg_regress fails with --outputdir parameter
In-Reply-To: <16484-4d89e9cc11241996@postgresql.org>
* 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