BUG #16484: pg_regress fails with --outputdir parameter
От | PG Bug reporting form |
---|---|
Тема | BUG #16484: pg_regress fails with --outputdir parameter |
Дата | |
Msg-id | 16484-4d89e9cc11241996@postgresql.org обсуждение исходный текст |
Ответы |
Re: BUG #16484: pg_regress fails with --outputdir parameter
|
Список | pgsql-bugs |
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: 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))
В списке pgsql-bugs по дате отправления: