diff options
author | Stefan Bühler <stbuehler@web.de> | 2009-08-08 12:51:05 +0000 |
---|---|---|
committer | Stefan Bühler <stbuehler@web.de> | 2009-08-08 12:51:05 +0000 |
commit | 0eff441bb62b5170e4d24f0a81d04b2abd7be498 (patch) | |
tree | e5940d9e65957b933d4c8dc11d396718f8191a56 /tests/LightyTest.pm | |
parent | 0413cf0ecfa5c9d5bdf1f7af32ac75101c3f0e1f (diff) | |
download | lighttpd-git-0eff441bb62b5170e4d24f0a81d04b2abd7be498.tar.gz |
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
Diffstat (limited to 'tests/LightyTest.pm')
-rwxr-xr-x | tests/LightyTest.pm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/LightyTest.pm b/tests/LightyTest.pm index 84f246cf..15bf583d 100755 --- a/tests/LightyTest.pm +++ b/tests/LightyTest.pm @@ -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; |