|
From: <jgr...@us...> - 2003-07-26 15:40:22
|
Update of /cvsroot/popfile/engine/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv19821/tests
Modified Files:
TestProxy.tst
Log Message:
Improve test suite for Proxy::Proxy
Index: TestProxy.tst
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestProxy.tst,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** TestProxy.tst 21 Jul 2003 19:54:26 -0000 1.7
--- TestProxy.tst 26 Jul 2003 15:40:19 -0000 1.8
***************
*** 105,109 ****
$sp->config_( 'port', $port );
test_assert_equal( $sp->start(), 1 );
! test_assert( $sp->start_server() );
# Now connect a socket to the proxy through which
--- 105,109 ----
$sp->config_( 'port', $port );
test_assert_equal( $sp->start(), 1 );
! test_assert_equal( $sp->start_server(), 1 );
# Now connect a socket to the proxy through which
***************
*** 247,250 ****
--- 247,252 ----
# Close down the child process
+ $sp->send( '__POPFILE__ABORT__CHILD__' );
+ $sp->service_server();
close $client;
$sp->stop_server();
***************
*** 254,261 ****
my @kids = keys %{$sp->{children__}};
! if ( $#kids >= 0 ) {
$sp->reaper();
@kids = keys %{$sp->{children__}};
}
! select( undef, undef, undef, 0.25 );
--- 256,355 ----
my @kids = keys %{$sp->{children__}};
! while ( $#kids >= 0 ) {
$sp->reaper();
+ select( undef, undef, undef, 0.25 );
@kids = keys %{$sp->{children__}};
}
! $sp->stop();
!
! # Make sure that stop will close off the child pipes
!
! $sp = new Test::SimpleProxy;
!
! $sp->configuration( $c );
! $sp->mq( $mq );
! $sp->logger( $l );
!
! $sp->forker( \&forker );
! $sp->pipeready( \&pipeready );
!
! $sp->initialize();
! $sp->config_( 'port', $port );
!
! test_assert_equal( $sp->start(), 1 );
! test_assert_equal( $sp->start_server(), 1 );
! $client = IO::Socket::INET->new(
! Proto => "tcp",
! PeerAddr => 'localhost',
! PeerPort => $port );
! $sp->service();
! test_assert( defined( $client ) );
! test_assert( $client->connected );
! $sp->service();
! select( undef, undef, undef, 0.1 );
! $sp->service_server();
! select( undef, undef, undef, 0.1 );
! @kids = keys %{$sp->{children__}};
! my %tmp = %{$sp->{children__}};
! test_assert_equal( $#kids, 0 );
! $sp->stop_server();
! $sp->stop();
! @kids = keys %{$sp->{children__}};
! test_assert_equal( $#kids, -1 );
! print $client "__POPFILE__ABORT__CHILD__\n";
! close $client;
!
! %{$sp->{children__}} = %tmp;
! @kids = keys %{$sp->{children__}};
! while ( $#kids >= 0 ) {
! $sp->reaper();
! select( undef, undef, undef, 0.25 );
! @kids = keys %{$sp->{children__}};
! }
!
! # Make sure that forked will close off the child pipes
!
! $sp = new Test::SimpleProxy;
!
! $sp->configuration( $c );
! $sp->mq( $mq );
! $sp->logger( $l );
!
! $sp->forker( \&forker );
! $sp->pipeready( \&pipeready );
!
! $sp->initialize();
! $sp->config_( 'port', $port );
!
! test_assert_equal( $sp->start(), 1 );
! test_assert_equal( $sp->start_server(), 1 );
! $client = IO::Socket::INET->new(
! Proto => "tcp",
! PeerAddr => 'localhost',
! PeerPort => $port );
! $sp->service();
! test_assert( defined( $client ) );
! test_assert( $client->connected );
! $sp->service();
! select( undef, undef, undef, 0.1 );
! $sp->service_server();
! select( undef, undef, undef, 0.1 );
! @kids = keys %{$sp->{children__}};
! test_assert_equal( $#kids, 0 );
! %tmp = %{$sp->{children__}};
! $sp->forked();
! @kids = keys %{$sp->{children__}};
! test_assert_equal( $#kids, -1 );
! $sp->stop_server();
! $sp->stop();
! print $client "__POPFILE__ABORT__CHILD__\n";
! close $client;
!
! %{$sp->{children__}} = %tmp;
! @kids = keys %{$sp->{children__}};
! while ( $#kids >= 0 ) {
! $sp->reaper();
! select( undef, undef, undef, 0.25 );
! @kids = keys %{$sp->{children__}};
! }
|