tests: fix endless loop if connect fails without the child dying

Found as make check on ubuntu hardy hanged itself, as perl-base
dependencies were broken and didn't require /etc/protocols but it
needed the file.


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2610 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.24
Stefan Bühler 14 years ago
parent 0413cf0ecf
commit 0eff441bb6

@ -87,14 +87,21 @@ sub wait_for_port_with_proc {
my $self = shift;
my $port = shift;
my $child = shift;
my $timeout = 5*10; # 5 secs, select waits 0.1 s
while (0 == $self->listening_on($port)) {
select(undef, undef, undef, 0.1);
$timeout--;
# the process is gone, we failed
if (0 != waitpid($child, WNOHANG)) {
return -1;
}
if (0 >= $timeout) {
diag("Timeout while trying to connect; killing child");
kill('TERM', $child);
return -1;
}
}
return 0;

Loading…
Cancel
Save