mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +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:
parent
f95850c546
commit
5cb9f166ec
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user