comparison lib/Test/Nginx.pm @ 628:0940773278c7

Tests: backed out previous change, adjusted general timeouts. The previous timeout values are commonly not enough when making mass-building.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 09 Jul 2015 14:09:27 +0300
parents 884b2f0c173f
children fca0079e0aab
comparison
equal deleted inserted replaced
627:cb35a9ec4428 628:0940773278c7
296 my $exited; 296 my $exited;
297 297
298 # wait for file to appear 298 # wait for file to appear
299 # or specified process to exit 299 # or specified process to exit
300 300
301 for (1 .. 30) { 301 for (1 .. 50) {
302 return 1 if -e $file; 302 return 1 if -e $file;
303 return 0 if $exited; 303 return 0 if $exited;
304 $exited = waitpid($pid, WNOHANG) != 0 if $pid; 304 $exited = waitpid($pid, WNOHANG) != 0 if $pid;
305 select undef, undef, undef, 0.1; 305 select undef, undef, undef, 0.1;
306 } 306 }
311 sub waitforsocket($) { 311 sub waitforsocket($) {
312 my ($self, $peer) = @_; 312 my ($self, $peer) = @_;
313 313
314 # wait for socket to accept connections 314 # wait for socket to accept connections
315 315
316 for (1 .. 30) { 316 for (1 .. 50) {
317 my $s = IO::Socket::INET->new( 317 my $s = IO::Socket::INET->new(
318 Proto => 'tcp', 318 Proto => 'tcp',
319 PeerAddr => $peer 319 PeerAddr => $peer
320 ); 320 );
321 321
539 my $s; 539 my $s;
540 540
541 eval { 541 eval {
542 local $SIG{ALRM} = sub { die "timeout\n" }; 542 local $SIG{ALRM} = sub { die "timeout\n" };
543 local $SIG{PIPE} = sub { die "sigpipe\n" }; 543 local $SIG{PIPE} = sub { die "sigpipe\n" };
544 alarm(5); 544 alarm(8);
545 545
546 $s = $extra{socket} || IO::Socket::INET->new( 546 $s = $extra{socket} || IO::Socket::INET->new(
547 Proto => 'tcp', 547 Proto => 'tcp',
548 PeerAddr => '127.0.0.1:8080' 548 PeerAddr => '127.0.0.1:8080'
549 ) 549 )
576 my $reply; 576 my $reply;
577 577
578 eval { 578 eval {
579 local $SIG{ALRM} = sub { die "timeout\n" }; 579 local $SIG{ALRM} = sub { die "timeout\n" };
580 local $SIG{PIPE} = sub { die "sigpipe\n" }; 580 local $SIG{PIPE} = sub { die "sigpipe\n" };
581 alarm(5); 581 alarm(8);
582 582
583 local $/; 583 local $/;
584 $reply = $s->getline(); 584 $reply = $s->getline();
585 585
586 alarm(0); 586 alarm(0);