Branch Coverage

blib/lib/Feersum/Runner.pm
Criterion Covered Total %
branch 75 376 19.9


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 } }
39 1 16 if ($INSTANCE)
41 0 1 if $Feersum::Runner::INSTANCE->{'running'}
52 1 17 if $self->{'_cleaned_up'}
54 6 11 if (my $f = $self->{'endjinn'})
60 0 17 if (my $file = $self->{'pid_file'})
61 0 0 if -f $file
76 0 14 if ($listen =~ m[^[/\.]+\w]) { }
78 0 0 if (-S $listen)
79 0 0 unless unlink $listen
90 0 0 if $err
91 0 0 unless $sock
92 0 0 unless ($sock->blocking(0))
97 0 14 if ($use_reuseport and defined 15) { }
100 0 0 if ($listen =~ /^\[([^\]]+)\]:(\d*)$/) { }
0 0 elsif ($listen =~ /^\[([^\]]+)\]$/) { }
0 0 elsif ($listen =~ /:.*:/) { }
108 0 0 if ($listen =~ /:(\d{1,5})$/)
111 0 0 if ($maybe_port <= 65535 and length $maybe_port == 5 || $maybe_port >= 1024)
126 0 0 if (not $port =~ /^\d+$/ or $port > 65535)
131 0 0 if ($is_ipv6) { }
132 0 0 unless defined 10
134 0 0 unless my $addr = inet_pton(10, $host)
139 0 0 unless my $addr = inet_aton($host)
146 0 0 unless socket $sock, $domain, 1, 0
149 0 0 unless (setsockopt $sock, 1, 2, "\1\0\0\0")
151 0 0 unless (setsockopt $sock, 1, 15, "\1\0\0\0")
153 0 0 unless (bind $sock, $sockaddr)
155 0 0 unless (listen $sock, $backlog)
161 0 0 unless ($sock->blocking(0))
165 14 0 if ($listen =~ /:(\d+)$/) { }
0 0 elsif ($listen =~ /:(\S+)$/) { }
167 0 14 if $port > 65535
170 0 0 unless $port =~ /^\d+$/
179 0 14 unless $sock
187 0 3 if (my $opts = $self->{'options'})
203 0 13 if (defined $self->{'listen'} and not ref $self->{'listen'})
209 0 13 if ref $self->{'listen'} ne "ARRAY"
211 0 13 if @{$self->{'listen'};} == 0
221 3 10 if ($self->{'pre_fork'})
223 0 3 if (not $n =~ /^\d+$/ or $n < 1)
226 0 3 if ($n > 1000)
239 2 0 if ($self->{'epoll_exclusive'} and $self->{'pre_fork'} and $^O eq "linux")
263 5 31 if (defined $val)
265 0 5 unless $val =~ /^-?\d+$/
266 3 2 if $val < -2 or $val > 2
273 0 10 if (defined(my $val = $self->{'max_accept_per_loop'}))
274 0 0 unless $val =~ /^\d+$/ and $val > 0
279 0 10 if (defined(my $val = $self->{'max_connections'}))
280 0 0 unless $val =~ /^\d+$/
288 10 0 if ($f->can("max_h2_concurrent_streams"))
293 8 2 if (not $self->{'tls'}) { }
294 1 7 if (my $cert = delete $self->{'tls_cert_file'}) { }
1 6 elsif (delete $self->{'tls_key_file'}) { }
296 1 0 unless my $key = delete $self->{'tls_key_file'}
308 2 6 if (my $tls = delete $self->{'tls'}) { }
309 0 2 unless ref $tls eq "HASH"
310 0 2 unless $tls->{'cert_file'}
311 0 2 unless $tls->{'key_file'}
312 2 0 unless -f $tls->{'cert_file'} and -r _
314 0 0 unless -f $tls->{'key_file'} and -r _
318 0 0 if (delete $self->{'h2'})
322 0 0 if ($f->has_tls) { }
328 0 0 unless $self->{'quiet'}
334 0 6 if (delete $self->{'h2'})
346 0 3 if (my $log_cb = $self->{'access_log'})
368 0 3 unless $self->{'quiet'}
374 0 3 if ($self->{'hot_restart'})
375 0 0 unless $self->{'app_file'}
387 0 3 if ($self->{'pre_fork'} and defined $self->{'preload_app'} and not $self->{'preload_app'}) { }
390 0 0 if (not $a and $self->{'app_file'})
393 0 0 if $@ or not $a
395 0 0 unless $a
403 0 0 if $self
407 3 0 if (not $app and $self->{'app_file'})
410 0 3 if $@
411 0 3 if $! and not defined $app
412 0 3 unless $app
415 0 3 unless $app
419 6 0 if $self
421 3 0 if $self->{'pre_fork'}
424 0 3 unless $self->{'quiet'}
436 0 0 unless $quiet
464 0 0 unless defined $pid
466 0 0 if ($pid == 0)
469 0 0 unless $quiet
489 0 0 if ($@ or not $app or ref $app ne "CODE")
500 0 0 if ($self->{'pre_fork'})
512 0 0 if ($self->{'pre_fork'})
517 0 0 if ($self->{'_use_reuseport'} and $^O eq "linux")
519 0 0 if $self->{'epoll_exclusive'} and $f->can("set_epoll_exclusive")
528 0 0 unless ($self->{'pre_fork'})
529 0 0 if $self->{'after_fork'}
532 0 0 if (my $max = $self->{'max_requests_per_worker'})
534 0 0 if ($f->total_requests >= $max)
546 0 0 $self->{'pre_fork'} ? :
0 0 unless $quiet
556 0 0 unless (_wait_for_ready($pending_pid, $quiet, $gen, \$shutting_down, $startup_timeout))
557 0 0 if kill 0, $pending_pid
564 0 0 unless $quiet
567 0 0 if $shutting_down or $pending_pid
568 0 0 unless $quiet
573 0 0 if (_wait_for_ready($pending_pid, $quiet, $gen, \$shutting_down, $startup_timeout)) { }
574 0 0 unless $quiet
577 0 0 if $old_pid
580 0 0 if kill 0, $pending_pid
587 0 0 if $shutting_down
589 0 0 unless $quiet
590 0 0 if $current_pid
594 0 0 if $shutting_down
596 0 0 unless $quiet
597 0 0 if $current_pid
604 0 0 unless $quiet
606 0 0 if $pending_pid and $kid == $pending_pid
607 0 0 if ($current_pid and $kid == $current_pid)
609 0 0 if $shutting_down
610 0 0 unless ($shutting_down)
613 0 0 if (_wait_for_ready($pending_pid, $quiet, $gen, \$shutting_down, $startup_timeout)) { }
618 0 0 if kill 0, $pending_pid
631 0 0 unless $quiet
658 0 0 if defined $self->{'keepalive'}
659 0 0 if defined $self->{'reverse_proxy'}
660 0 0 if defined $self->{'proxy_protocol'}
661 0 0 if defined $self->{'psgix_io'}
662 0 0 if defined $self->{'read_timeout'}
663 0 0 if defined $self->{'header_timeout'}
664 0 0 if defined $self->{'write_timeout'}
665 0 0 if defined $self->{'max_connection_reqs'}
666 0 0 if defined $self->{'read_priority'}
667 0 0 if defined $self->{'write_priority'}
668 0 0 if defined $self->{'accept_priority'}
669 0 0 if defined $self->{'max_accept_per_loop'}
670 0 0 if defined $self->{'max_connections'}
671 0 0 if defined $self->{'max_read_buf'}
672 0 0 if defined $self->{'max_body_len'}
673 0 0 if defined $self->{'max_uri_len'}
674 0 0 if defined $self->{'wbuf_low_water'}
676 0 0 if defined $self->{'max_h2_concurrent_streams'}
679 0 0 if (my $tls = $self->{'tls'})
680 0 0 if ($f->has_tls)
681 0 0 unless $self->{'_master_socks'}
693 0 20 unless defined $pid
694 0 20 unless ($pid)
696 0 0 unless $self->{'quiet'}
703 0 0 if ($self->{'_use_reuseport'})
705 0 0 unless $self->{'_socks'}
707 0 0 unless (close $old_sock)
717 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 } })
725 0 0 if (my $tls = $self->{'_tls_config'})
733 0 0 if (my $loader = $self->{'_app_loader'})
735 0 0 if ($@)
741 0 0 if (my $cb = $self->{'after_fork'})
745 0 0 if (my $max = $self->{'max_requests_per_worker'})
748 0 0 if ($f->total_requests >= $max)
756 0 0 if $@
757 0 0 $@ ? :
764 0 20 unless $self
765 0 20 unless $self->{'quiet'}
768 20 0 if ($self->{'_shutdown'})
769 3 17 unless ($self->{'_n_kids'})
776 0 0 if ($self->{'_use_reuseport'}) { }
778 0 0 unless $self->{'_socks'}
781 0 0 unless (defined fileno $sock)
786 0 0 if ($all_valid) { }
810 0 3 unless POSIX::setsid()
821 0 3 if ($self->{'_use_reuseport'})
822 0 0 unless $self->{'_socks'}
823 0 0 unless close $sock
835 0 3 if ($self->{'daemonize'}) { }
0 3 elsif (my $file = $self->{'pid_file'}) { }
837 0 0 unless defined $pid
838 0 0 if ($pid)
839 0 0 if (my $file = $self->{'pid_file'})
840 0 0 unless open my $fh, ">", $file
847 0 0 unless open STDIN, "<", "/dev/null"
848 0 0 unless open STDOUT, ">", "/dev/null"
850 0 0 unless $ENV{'FEERSUM_DEBUG'}
852 0 0 unless open my $fh, ">", $file
860 0 3 if (my $group = $self->{'group'})
862 0 0 unless defined $gid
863 0 0 unless POSIX::setgid($gid)
865 0 3 if (my $user = $self->{'user'})
867 0 0 unless defined $uid
868 0 0 unless POSIX::setuid($uid)
874 3 3 if $self->{'_shutdown'}
877 0 3 unless $self->{'quiet'}
882 3 0 if ($self->{'_n_kids'}) { }