mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-02-07 13:42:41 +02:00
Refactor storage layer to allow for new repository filesystems using drivers. (Reviewed by Cynthia Shang.) Refactor IO layer to allow for new compression formats, checksum types, and other capabilities using filters. (Reviewed by Cynthia Shang.)
60 lines
2.8 KiB
Perl
60 lines
2.8 KiB
Perl
####################################################################################################################################
|
|
# CommonIoProcessTest.pm - tests for Common::Io::Process module
|
|
####################################################################################################################################
|
|
package pgBackRestTest::Module::Common::CommonIoProcessTest;
|
|
use parent 'pgBackRestTest::Common::RunTest';
|
|
|
|
####################################################################################################################################
|
|
# Perl includes
|
|
####################################################################################################################################
|
|
use strict;
|
|
use warnings FATAL => qw(all);
|
|
use Carp qw(confess);
|
|
use English '-no_match_vars';
|
|
|
|
use pgBackRest::Common::Exception;
|
|
use pgBackRest::Common::Io::Buffered;
|
|
use pgBackRest::Common::Io::Process;
|
|
use pgBackRest::Common::Log;
|
|
|
|
use pgBackRestTest::Common::ExecuteTest;
|
|
use pgBackRestTest::Common::RunTest;
|
|
|
|
####################################################################################################################################
|
|
# run
|
|
####################################################################################################################################
|
|
sub run
|
|
{
|
|
my $self = shift;
|
|
|
|
# Test data
|
|
my $strFile = $self->testPath() . qw{/} . 'file.txt';
|
|
my $strFileContent = 'TESTDATA';
|
|
|
|
################################################################################################################################
|
|
if ($self->begin('new() & processId()'))
|
|
{
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
|
my $oIoProcess = $self->testResult(sub {
|
|
new pgBackRest::Common::Io::Process(
|
|
new pgBackRest::Common::Io::Buffered(
|
|
new pgBackRest::Common::Io::Handle('test'), 1, 32), "echo '${strFileContent}'")}, '[object]', 'new - echo');
|
|
$self->testResult(sub {defined($oIoProcess->processId())}, true, ' process id defined');
|
|
}
|
|
|
|
################################################################################################################################
|
|
if ($self->begin('close() & error()'))
|
|
{
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
|
my $oIoProcess =
|
|
new pgBackRest::Common::Io::Process(
|
|
new pgBackRest::Common::Io::Buffered(
|
|
new pgBackRest::Common::Io::Handle('test'), 1, 32), "echo '${strFileContent}'");
|
|
$oIoProcess->close();
|
|
$self->testException(
|
|
sub {$oIoProcess->error()}, ERROR_ASSERT, 'cannot call error() after process has been closed');
|
|
}
|
|
}
|
|
|
|
1;
|