Fix TAP tests for older Perls.

Commit 7132810c (Retain tempdirs for failed tests) used Test::More's
is_passing method, but that was added in Test::More 0.89_01 which is
sometime later than Perl 5.10.1.  Popular platforms such as RHEL6 don't
have that, nevermind some of our older dinosaurs.  Do it the hard way.

Michael Paquier, based on research by Craig Ringer
This commit is contained in:
Tom Lane 2016-03-02 01:06:31 -05:00
parent a892234f83
commit 3b8d721553
1 changed files with 11 additions and 1 deletions

View File

@ -110,7 +110,17 @@ INIT
END
{
# Preserve temporary directory for this test on failure
$File::Temp::KEEP_ALL = 1 unless Test::More->builder->is_passing;
$File::Temp::KEEP_ALL = 1 unless all_tests_passing();
}
sub all_tests_passing
{
my $fail_count = 0;
foreach my $status (Test::More->builder->summary)
{
return 0 unless $status;
}
return 1;
}
#