You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-09-16 09:06:18 +02:00
Add stderr to unit test error messages.
Messages on stderr were being lost due to the error suppression used to customize the error message. Also update the formatting to be more informative and concise.
This commit is contained in:
@@ -233,7 +233,9 @@ sub endRetry
|
||||
if ($self->{bSuppressError})
|
||||
{
|
||||
&log(DEBUG, "suppressed error was ${iExitStatus}");
|
||||
$self->{strErrorLog} = '';
|
||||
|
||||
# Make a copy of the suppressed error log in case it is needed
|
||||
$self->{strSuppressedErrorLog} = $self->{strErrorLog};
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -657,9 +657,29 @@ sub end
|
||||
# Output error
|
||||
if ($iExitStatus != 0)
|
||||
{
|
||||
# Get stdout
|
||||
my $strOutput = trim($oExecDone->{strOutLog}) ? "STDOUT:\n" . trim($oExecDone->{strOutLog}) : '';
|
||||
|
||||
# Get stderr
|
||||
if (trim($oExecDone->{strSuppressedErrorLog}) ne '')
|
||||
{
|
||||
if ($strOutput ne '')
|
||||
{
|
||||
$strOutput .= "\n";
|
||||
}
|
||||
|
||||
$strOutput .= "STDERR:\n" . trim($oExecDone->{strSuppressedErrorLog});
|
||||
}
|
||||
|
||||
# If no stdout or stderr output something rather than a blank line
|
||||
if ($strOutput eq '')
|
||||
{
|
||||
$strOutput = 'NO OUTPUT ON STDOUT OR STDERR';
|
||||
}
|
||||
|
||||
&log(ERROR, "${strTestDone} (err${iExitStatus}" . ($self->{bLogTimestamp} ? "-${fTestElapsedTime}s)" : '') .
|
||||
(defined($oExecDone->{strOutLog}) && !$self->{bShowOutputAsync} ?
|
||||
":\n\n" . trim($oExecDone->{strOutLog}) . "\n" : ''), undef, undef, 4);
|
||||
(defined($oExecDone->{strOutLog}) && !$self->{bShowOutputAsync} ? ":\n\n${strOutput}\n" : ''), undef, undef, 4);
|
||||
|
||||
$bFail = true;
|
||||
}
|
||||
# Output success
|
||||
|
Reference in New Issue
Block a user