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

Commit460c007

Browse files
committed
Better handle interrupting TAP tests
Set up a signal handler for INT/TERM so that we run our END block if weget them. In END, if the exit status indicates a problem, call_update_pid(-1) to improve chances of the stop working in case start()hasn't returned yet.Also, change END's teardown_node() so that it passes fail_ok=>1, so thatif a node fails to stop, we still stop the other nodes in the same test.Per complaint from Andres Freund.This doesn't seem important enough to backpatch, at least for now.Discussion:https://postgr.es/m/20220930040734.mbted42oiynhn2t6@awork3.anarazel.de
1 parent342bb38 commit460c007

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

‎src/test/perl/PostgreSQL/Test/Cluster.pm

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,14 @@ END
15451545

15461546
foreachmy$node (@all_nodes)
15471547
{
1548-
$node->teardown_node;
1548+
# During unclean termination (which could be a signal or some
1549+
# other failure), we're not sure that the status of our nodes
1550+
# has been correctly set up already, so try and update it to
1551+
# improve our chances of shutting them down.
1552+
$node->_update_pid(-1)if$exit_code != 0;
1553+
1554+
# If that fails, don't let that foil other nodes' shutdown
1555+
$node->teardown_node(fail_ok=> 1);
15491556

15501557
# skip clean if we are requested to retain the basedir
15511558
nextifdefined$ENV{'PG_TEST_NOCLEAN'};
@@ -1564,13 +1571,15 @@ END
15641571
15651572
Do an immediate stop of the node
15661573
1574+
Any optional extra parameter is passed to ->stop.
1575+
15671576
=cut
15681577

15691578
subteardown_node
15701579
{
1571-
my$self =shift;
1580+
my($self,%params) =@_;
15721581

1573-
$self->stop('immediate');
1582+
$self->stop('immediate',%params);
15741583
return;
15751584
}
15761585

@@ -2922,6 +2931,13 @@ sub corrupt_page_checksum
29222931
return;
29232932
}
29242933

2934+
#
2935+
# Signal handlers
2936+
#
2937+
$SIG{TERM} =$SIG{INT} =sub {
2938+
die"death by signal";
2939+
};
2940+
29252941
=pod
29262942
29272943
=back

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp