Branch Coverage

blib/lib/Feersum/Runner.pm
Criterion Covered Total %
branch 66 194 34.0


line true false branch
12 0 9 unless (eval { do { "Socket"->import("AF_INET6", "inet_pton", "pack_sockaddr_in6"); 1 } })
21 0 9 unless eval { do { "Socket"->import("SO_REUSEPORT"); 1 } }
37 1 16 if ($INSTANCE)
39 0 1 if $Feersum::Runner::INSTANCE->{'running'}
50 1 17 if $self->{'_cleaned_up'}
52 6 11 if (my $f = $self->{'endjinn'})
70 0 14 if ($listen =~ m[^[/\.]+\w]) { }
72 0 0 if (-S $listen)
73 0 0 unless unlink $listen
84 0 0 if $err
85 0 0 unless $sock
86 0 0 unless ($sock->blocking(0))
91 0 14 if ($use_reuseport and defined 15) { }
94 0 0 if ($listen =~ /^\[([^\]]+)\]:(\d*)$/) { }
0 0 elsif ($listen =~ /^\[([^\]]+)\]$/) { }
0 0 elsif ($listen =~ /:.*:/) { }
102 0 0 if ($listen =~ /:(\d{1,5})$/)
105 0 0 if ($maybe_port <= 65535 and length $maybe_port == 5 || $maybe_port >= 1024)
120 0 0 if (not $port =~ /^\d+$/ or $port > 65535)
125 0 0 if ($is_ipv6) { }
126 0 0 unless defined 10
128 0 0 unless my $addr = inet_pton(10, $host)
133 0 0 unless my $addr = inet_aton($host)
140 0 0 unless socket $sock, $domain, 1, 0
143 0 0 unless (setsockopt $sock, 1, 2, "\1\0\0\0")
145 0 0 unless (setsockopt $sock, 1, 15, "\1\0\0\0")
147 0 0 unless (bind $sock, $sockaddr)
149 0 0 unless (listen $sock, 4096)
155 0 0 unless ($sock->blocking(0))
159 14 0 if ($listen =~ /:(\d+)$/) { }
0 0 elsif ($listen =~ /:(\S+)$/) { }
161 0 14 if $port > 65535
164 0 0 unless $port =~ /^\d+$/
173 0 14 unless $sock
183 0 13 if (defined $self->{'listen'} and not ref $self->{'listen'})
189 0 13 if ref $self->{'listen'} ne "ARRAY"
191 0 13 if @{$self->{'listen'};} == 0
194 0 13 if (my $opts = $self->{'options'})
207 3 10 if ($self->{'pre_fork'})
209 0 3 if (not $n =~ /^\d+$/ or $n < 1)
212 0 3 if ($n > 1000)
225 2 0 if ($self->{'epoll_exclusive'} and $self->{'pre_fork'} and $^O eq "linux")
250 5 31 if (defined $val)
252 0 5 unless $val =~ /^-?\d+$/
253 3 2 if $val < -2 or $val > 2
260 0 10 if (defined(my $val = $self->{'max_accept_per_loop'}))
261 0 0 unless $val =~ /^\d+$/ and $val > 0
266 0 10 if (defined(my $val = $self->{'max_connections'}))
267 0 0 unless $val =~ /^\d+$/
277 8 2 if (not $self->{'tls'}) { }
278 1 7 if (my $cert = delete $self->{'tls_cert_file'}) { }
1 6 elsif (delete $self->{'tls_key_file'}) { }
280 1 0 unless my $key = delete $self->{'tls_key_file'}
292 2 6 if (my $tls = delete $self->{'tls'}) { }
293 0 2 unless ref $tls eq "HASH"
294 0 2 unless $tls->{'cert_file'}
295 0 2 unless $tls->{'key_file'}
296 2 0 unless -f $tls->{'cert_file'} and -r _
298 0 0 unless -f $tls->{'key_file'} and -r _
302 0 0 if (delete $self->{'h2'})
306 0 0 if ($f->has_tls) { }
312 0 0 unless $self->{'quiet'}
318 0 6 if (delete $self->{'h2'})
337 0 3 unless $self->{'quiet'}
342 3 0 if (not $app and $self->{'app_file'})
345 0 3 if $@
346 0 3 if $! and not defined $app
347 0 3 unless $app
350 0 3 unless $app
354 6 0 if $self
356 3 0 if $self->{'pre_fork'}
358 0 3 unless $self->{'quiet'}
367 0 20 unless defined $pid
368 0 20 unless ($pid)
370 0 0 unless $self->{'quiet'}
377 0 0 if ($self->{'_use_reuseport'})
379 0 0 unless $self->{'_socks'}
381 0 0 unless (close $old_sock)
391 0 0 unless (eval { do { foreach my $listen (@{$$self{"_listen_addrs"};}) { my $sock = $self->_create_socket($listen, 1); push @new_socks, $sock; $self->{'endjinn'}->use_socket($sock); } ; 1 } })
399 0 0 if (my $tls = $self->{'_tls_config'})
407 0 0 if $@
408 0 0 $@ ? :
415 0 20 unless $self
416 0 20 unless $self->{'quiet'}
419 20 0 if ($self->{'_shutdown'})
420 3 17 unless ($self->{'_n_kids'})
427 0 0 if ($self->{'_use_reuseport'}) { }
429 0 0 unless $self->{'_socks'}
432 0 0 unless (defined fileno $sock)
437 0 0 if ($all_valid) { }
460 0 3 unless POSIX::setsid()
471 0 3 if ($self->{'_use_reuseport'})
472 0 0 unless $self->{'_socks'}
473 0 0 unless close $sock
484 3 3 if $self->{'_shutdown'}
487 0 3 unless $self->{'quiet'}
490 3 0 if ($self->{'_n_kids'}) { }