1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-15 01:04:37 +02:00

Add new test for Common::Io::Process.

Show that output on stderr will raise an exception on close() even if the exit code is 0.
This commit is contained in:
David Steele
2018-03-08 12:36:55 -05:00
parent 62a9bdbd4c
commit e331564c90
3 changed files with 18 additions and 1 deletions

View File

@ -97,6 +97,10 @@
<p>Disable console display of coverage for C files since <code>Devel::Cover</code> does not handle it well.</p>
</release-item>
<release-item>
<p>Add new test for <code>Common::Io::Process</code> to show that output on stderr will raise an exception on <code>close()</code> even if the exit code is 0.</p>
</release-item>
<release-item>
<p>Remove Debian package patch now that it has been merged upstream.</p>
</release-item>

View File

@ -318,7 +318,7 @@ my $oTestDef =
},
{
&TESTDEF_NAME => 'io-process',
&TESTDEF_TOTAL => 2,
&TESTDEF_TOTAL => 3,
&TESTDEF_COVERAGE =>
{

View File

@ -42,6 +42,19 @@ sub run
$self->testResult(sub {defined($oIoProcess->processId())}, true, ' process id defined');
}
################################################################################################################################
if ($self->begin('close() and error when stderr has data'))
{
#---------------------------------------------------------------------------------------------------------------------------
my $oIoProcess =
new pgBackRest::Common::Io::Process(
new pgBackRest::Common::Io::Buffered(
new pgBackRest::Common::Io::Handle('test'), 1, 32), "echo '${strFileContent}' 1>&2");
$self->testException(
sub {$oIoProcess->close()}, ERROR_FILE_READ, 'test terminated unexpectedly [000]: TESTDATA');
}
################################################################################################################################
if ($self->begin('close() & error()'))
{