BUG #16484: pg_regress fails with --outputdir parameter

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: r(dot)zharkov(at)postgrespro(dot)ru
Subject: BUG #16484: pg_regress fails with --outputdir parameter
Date: 2020-06-08 05:45:30
Message-ID: 16484-4d89e9cc11241996@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16484
Logged by: Roman Zharkov
Email address: r(dot)zharkov(at)postgrespro(dot)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:

diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 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, const
char *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))

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kyotaro Horiguchi 2020-06-08 08:27:30 Re: BUG #16481: Stored Procedure Triggered by Logical Replication is Unable to use Notification Events
Previous Message Peter Geoghegan 2020-06-08 02:59:09 Re: Potential G2-item cycles under serializable isolation