Skip to content

Commit af36c13

Browse files
committed
Make PG_TEST_NOCLEAN work for temporary directories in TAP tests
When set, this environment variable was only effective for data directories but not for all the other temporary files created by PostgreSQL::Test::Utils. Keeping the temporary files after a successful run can be useful for debugging purposes. The documentation is updated to reflect the new behavior, with contents available in doc/ since v16 and in src/test/perl/README since v15. Author: Jacob Champion Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/CAAWbhmgHtDH1SGZ+Fw05CsXtE0mzTmjbuUxLB9mY9iPKgM6cUw@mail.gmail.com Discussion: https://postgr.es/m/YyPd9unV14SX2bLF@paquier.xyz Backpatch-through: 11
1 parent dbe0e5c commit af36c13

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/test/perl/TestLib.pm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,16 @@ sub tempdir
187187
return File::Temp::tempdir(
188188
$prefix . '_XXXX',
189189
DIR => $tmp_check,
190-
CLEANUP => 1);
190+
CLEANUP => not defined $ENV{'PG_TEST_NOCLEAN'});
191191
}
192192

193193
sub tempdir_short
194194
{
195195

196196
# Use a separate temp dir outside the build tree for the
197197
# Unix-domain socket, to avoid file name length issues.
198-
return File::Temp::tempdir(CLEANUP => 1);
198+
return File::Temp::tempdir(
199+
CLEANUP => not defined $ENV{'PG_TEST_NOCLEAN'});
199200
}
200201

201202
=pod

0 commit comments

Comments
 (0)