Skip to content

Commit bf989aa

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 815c2f0 commit bf989aa

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

src/test/perl/PostgresNode.pm

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,20 +1233,6 @@ sub can_bind
12331233
return $ret;
12341234
}
12351235

1236-
# Retain the errno on die() if set, else assume a generic errno of 1.
1237-
# This will instruct the END handler on how to handle artifacts left
1238-
# behind from tests.
1239-
$SIG{__DIE__} = sub {
1240-
if ($!)
1241-
{
1242-
$died = $!;
1243-
}
1244-
else
1245-
{
1246-
$died = 1;
1247-
}
1248-
};
1249-
12501236
# Automatically shut down any still-running nodes when the test script exits.
12511237
# Note that this just stops the postmasters (in the same order the nodes were
12521238
# created in). Any temporary directories are deleted, in an unspecified
@@ -1265,8 +1251,7 @@ END
12651251
next if defined $ENV{'PG_TEST_NOCLEAN'};
12661252

12671253
# clean basedir on clean test invocation
1268-
$node->clean_node
1269-
if TestLib::all_tests_passing() && !defined $died && !$exit_code;
1254+
$node->clean_node if $exit_code == 0 && TestLib::all_tests_passing();
12701255
}
12711256

12721257
$? = $exit_code;

src/test/perl/TestLib.pm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,13 @@ INIT
183183
END
184184
{
185185

186-
# Preserve temporary directory for this test on failure
187-
$File::Temp::KEEP_ALL = 1 unless all_tests_passing();
186+
# Test files have several ways of causing prove_check to fail:
187+
# 1. Exit with a non-zero status.
188+
# 2. Call ok(0) or similar, indicating that a constituent test failed.
189+
# 3. Deviate from the planned number of tests.
190+
#
191+
# Preserve temporary directories after (1) and after (2).
192+
$File::Temp::KEEP_ALL = 1 unless $? == 0 && all_tests_passing();
188193
}
189194

190195
=pod

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy