summaryrefslogtreecommitdiff
path: root/tests/LightyTest.pm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/LightyTest.pm')
-rwxr-xr-xtests/LightyTest.pm7
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;