summaryrefslogtreecommitdiff
path: root/src/test/perl/TestLib.pm
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2020-02-05 08:26:41 -0800
committerNoah Misch <noah@leadboat.com>2020-02-05 08:26:41 -0800
commitbf989aaf35613ed2c2a66e120ca600e7b9da4f82 (patch)
treea54d9fe5e36beb5de6b2c7cb2936c54e9c4c31b9 /src/test/perl/TestLib.pm
parent815c2f0972c8386aba7c606f1ee6690d13b04db2 (diff)
downloadpostgresql-bf989aaf35613ed2c2a66e120ca600e7b9da4f82.tar.gz
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 88802e068017bee8cea7a5502a712794e761c7b5 introduced retention on failure. Reviewed by Daniel Gustafsson. Discussion: https://postgr.es/m/20200202170155.GA3264196@rfd.leadboat.com
Diffstat (limited to 'src/test/perl/TestLib.pm')
-rw-r--r--src/test/perl/TestLib.pm9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index 458b801379..65ee0425b0 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -183,8 +183,13 @@ INIT
END
{
- # Preserve temporary directory for this test on failure
- $File::Temp::KEEP_ALL = 1 unless all_tests_passing();
+ # Test files have several ways of causing prove_check to fail:
+ # 1. Exit with a non-zero status.
+ # 2. Call ok(0) or similar, indicating that a constituent test failed.
+ # 3. Deviate from the planned number of tests.
+ #
+ # Preserve temporary directories after (1) and after (2).
+ $File::Temp::KEEP_ALL = 1 unless $? == 0 && all_tests_passing();
}
=pod