Skip to content

Commit d8efc59

Browse files
committed
When a TAP file has non-zero exit status, retain temporary directories.
PostgresNode already retained base directories in such cases. Stop using $SIG{__DIE__}, which is redundant with the exit status check, in lieu of proliferating it to TestLib. Back-patch to 9.6, where commit 88802e0 introduced retention on failure. Reviewed by Daniel Gustafsson. Discussion: https://postgr.es/m/20200202170155.GA3264196@rfd.leadboat.com
1 parent 80dece6 commit d8efc59

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/test/perl/TestLib.pm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,13 @@ INIT
122122
END
123123
{
124124

125-
# Preserve temporary directory for this test on failure
126-
$File::Temp::KEEP_ALL = 1 unless all_tests_passing();
125+
# Test files have several ways of causing prove_check to fail:
126+
# 1. Exit with a non-zero status.
127+
# 2. Call ok(0) or similar, indicating that a constituent test failed.
128+
# 3. Deviate from the planned number of tests.
129+
#
130+
# Preserve temporary directories after (1) and after (2).
131+
$File::Temp::KEEP_ALL = 1 unless $? == 0 && all_tests_passing();
127132
}
128133

129134
sub all_tests_passing

0 commit comments

Comments
 (0)