Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit887657d

Browse files
committed
When a TAP file has non-zero exit status, retain temporary directories.
PostgresNode already retained base directories in such cases. Stopusing $SIG{__DIE__}, which is redundant with the exit status check, inlieu of proliferating it to TestLib. Back-patch to 9.6, where commit88802e0 introduced retention onfailure.Reviewed by Daniel Gustafsson.Discussion:https://postgr.es/m/20200202170155.GA3264196@rfd.leadboat.com
1 parentb25d47b commit887657d

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
@@ -1157,20 +1157,6 @@ sub can_bind
11571157
return$ret;
11581158
}
11591159

1160-
# Retain the errno on die() if set, else assume a generic errno of 1.
1161-
# This will instruct the END handler on how to handle artifacts left
1162-
# behind from tests.
1163-
$SIG{__DIE__} =sub {
1164-
if ($!)
1165-
{
1166-
$died =$!;
1167-
}
1168-
else
1169-
{
1170-
$died = 1;
1171-
}
1172-
};
1173-
11741160
# Automatically shut down any still-running nodes when the test script exits.
11751161
# Note that this just stops the postmasters (in the same order the nodes were
11761162
# created in). Any temporary directories are deleted, in an unspecified
@@ -1189,8 +1175,7 @@ END
11891175
nextifdefined$ENV{'PG_TEST_NOCLEAN'};
11901176

11911177
# clean basedir on clean test invocation
1192-
$node->clean_node
1193-
if TestLib::all_tests_passing() && !defined$died && !$exit_code;
1178+
$node->clean_nodeif$exit_code == 0 && TestLib::all_tests_passing();
11941179
}
11951180

11961181
$? =$exit_code;

‎src/test/perl/TestLib.pm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,13 @@ INIT
129129
END
130130
{
131131

132-
# Preserve temporary directory for this test on failure
133-
$File::Temp::KEEP_ALL = 1unless all_tests_passing();
132+
# Test files have several ways of causing prove_check to fail:
133+
# 1. Exit with a non-zero status.
134+
# 2. Call ok(0) or similar, indicating that a constituent test failed.
135+
# 3. Deviate from the planned number of tests.
136+
#
137+
# Preserve temporary directories after (1) and after (2).
138+
$File::Temp::KEEP_ALL = 1unless$? == 0 && all_tests_passing();
134139
}
135140

136141
suball_tests_passing

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp