Branch Coverage

blib/lib/Feersum/Runner.pm
Criterion Covered Total %
branch 79 386 20.4


line true false branch
12 0 10 unless (eval { do { "Socket"->import("AF_INET6", "inet_pton", "pack_sockaddr_in6"); 1 } })
21 0 10 unless eval { do { "Socket"->import("SO_REUSEPORT"); 1 } }
38 2 17 if ($INSTANCE)
40 0 2 if $Feersum::Runner::INSTANCE->{'running'}
51 2 18 if $self->{'_cleaned_up'}
53 6 12 if (my $f = $self->{'endjinn'})
59 0 18 if (my $file = $self->{'pid_file'})
60 0 0 if -f $file
75 0 14 if ($listen =~ m[^[/\.]+\w]) { }
77 0 0 if (-S $listen)
78 0 0 unless unlink $listen
89 0 0 if $err
90 0 0 unless $sock
91 0 0 unless ($sock->blocking(0))
96 0 14 if ($use_reuseport and defined 15) { }
99 0 0 if ($listen =~ /^\[([^\]]+)\]:(\d*)$/) { }
0 0 elsif ($listen =~ /^\[([^\]]+)\]$/) { }
0 0 elsif ($listen =~ /:.*:/) { }
107 0 0 if ($listen =~ /:(\d{1,5})$/)
110 0 0 if ($maybe_port <= 65535 and length $maybe_port == 5 || $maybe_port >= 1024)
125 0 0 if (not $port =~ /^\d+$/ or $port > 65535)
130 0 0 if ($is_ipv6) { }
131 0 0 unless defined 10
133 0 0 unless my $addr = inet_pton(10, $host)
138 0 0 unless my $addr = inet_aton($host)
145 0 0 unless socket $sock, $domain, 1, 0
148 0 0 unless (setsockopt $sock, 1, 2, "\1\0\0\0")
150 0 0 unless (setsockopt $sock, 1, 15, "\1\0\0\0")
152 0 0 unless (bind $sock, $sockaddr)
154 0 0 unless (listen $sock, $backlog)
160 0 0 unless ($sock->blocking(0))
164 14 0 if ($listen =~ /:(\d+)$/) { }
0 0 elsif ($listen =~ /:(\S+)$/) { }
166 0 14 if $port > 65535
169 0 0 unless $port =~ /^\d+$/
178 0 14 unless $sock
186 0 3 if (my $opts = $self->{'options'})
205 0 0 if ($sni)
206 0 0 unless ref $sni eq "ARRAY"
217 0 13 if (defined $self->{'listen'} and not ref $self->{'listen'})
223 0 13 if ref $self->{'listen'} ne "ARRAY"
225 0 13 if @{$self->{'listen'};} == 0
235 3 10 if ($self->{'pre_fork'})
237 0 3 if (not $n =~ /^\d+$/ or $n < 1)
240 0 3 if ($n > 1000)
253 2 0 if ($self->{'epoll_exclusive'} and $self->{'pre_fork'} and $^O eq "linux")
277 5 31 if (defined $val)
279 0 5 unless $val =~ /^-?\d+$/
280 3 2 if $val < -2 or $val > 2
287 0 10 if (defined(my $val = $self->{'max_accept_per_loop'}))
288 0 0 unless $val =~ /^\d+$/ and $val > 0
293 0 10 if (defined(my $val = $self->{'max_connections'}))
294 0 0 unless $val =~ /^\d+$/
302 10 0 if ($f->can("max_h2_concurrent_streams"))
307 8 2 if (not $self->{'tls'}) { }
308 1 7 if (my $cert = delete $self->{'tls_cert_file'}) { }
1 6 elsif (delete $self->{'tls_key_file'}) { }
310 1 0 unless my $key = delete $self->{'tls_key_file'}
322 2 6 if (my $tls = delete $self->{'tls'}) { }
323 0 2 unless ref $tls eq "HASH"
324 0 2 unless $tls->{'cert_file'}
325 0 2 unless $tls->{'key_file'}
326 2 0 unless -f $tls->{'cert_file'} and -r _
328 0 0 unless -f $tls->{'key_file'} and -r _
332 0 0 if (delete $self->{'h2'})
336 0 0 if ($f->has_tls) { }
339 0 0 unless $self->{'quiet'}
345 0 6 if (delete $self->{'h2'})
357 0 3 if (my $log_cb = $self->{'access_log'})
379 0 3 unless $self->{'quiet'}
385 0 3 if ($self->{'hot_restart'})
386 0 0 unless $self->{'app_file'}
398 0 3 if ($self->{'pre_fork'} and defined $self->{'preload_app'} and not $self->{'preload_app'}) { }
401 0 0 if (not $a and $self->{'app_file'})
404 0 0 if $@ or not $a
406 0 0 unless $a
414 0 0 if $self
418 3 0 if (not $app and $self->{'app_file'})
421 0 3 if $@
422 0 3 if $! and not defined $app
423 0 3 unless $app
426 0 3 unless $app
430 6 0 if $self
432 3 0 if $self->{'pre_fork'}
435 0 3 unless $self->{'quiet'}
447 0 0 unless $quiet
478 0 0 unless defined $pid
480 0 0 if ($pid == 0)
483 0 0 unless $quiet
503 0 0 if ($@ or not $app or ref $app ne "CODE")
514 0 0 if ($self->{'pre_fork'})
526 0 0 if ($self->{'pre_fork'})
531 0 0 if ($self->{'_use_reuseport'} and $^O eq "linux")
533 0 0 if $self->{'epoll_exclusive'} and $f->can("set_epoll_exclusive")
542 0 0 unless ($self->{'pre_fork'})
543 0 0 if $self->{'after_fork'}
546 0 0 if (my $max = $self->{'max_requests_per_worker'})
548 0 0 if ($f->total_requests >= $max)
560 0 0 $self->{'pre_fork'} ? :
0 0 unless $quiet
570 0 0 unless (_wait_for_ready($pending_pid, $quiet, $gen, \$shutting_down, $startup_timeout))
571 0 0 if kill 0, $pending_pid
578 0 0 unless $quiet
581 0 0 if $shutting_down or $pending_pid
582 0 0 unless $quiet
587 0 0 if (_wait_for_ready($pending_pid, $quiet, $gen, \$shutting_down, $startup_timeout)) { }
588 0 0 unless $quiet
591 0 0 if $old_pid
594 0 0 if kill 0, $pending_pid
601 0 0 if $shutting_down
603 0 0 unless $quiet
604 0 0 if $current_pid
607 0 0 if $pending_pid
611 0 0 if $shutting_down
613 0 0 unless $quiet
614 0 0 if $current_pid
615 0 0 if $pending_pid
622 0 0 unless $quiet
624 0 0 if $pending_pid and $kid == $pending_pid
625 0 0 if ($current_pid and $kid == $current_pid)
627 0 0 if $shutting_down
628 0 0 unless ($shutting_down or $pending_pid)
631 0 0 if (_wait_for_ready($pending_pid, $quiet, $gen, \$shutting_down, $startup_timeout)) { }
636 0 0 if kill 0, $pending_pid
649 0 0 unless $quiet
676 0 0 if defined $self->{'keepalive'}
677 0 0 if defined $self->{'reverse_proxy'}
678 0 0 if defined $self->{'proxy_protocol'}
679 0 0 if defined $self->{'psgix_io'}
680 0 0 if defined $self->{'read_timeout'}
681 0 0 if defined $self->{'header_timeout'}
682 0 0 if defined $self->{'write_timeout'}
683 0 0 if defined $self->{'max_connection_reqs'}
684 0 0 if defined $self->{'read_priority'}
685 0 0 if defined $self->{'write_priority'}
686 0 0 if defined $self->{'accept_priority'}
687 0 0 if defined $self->{'max_accept_per_loop'}
688 0 0 if defined $self->{'max_connections'}
689 0 0 if defined $self->{'max_read_buf'}
690 0 0 if defined $self->{'max_body_len'}
691 0 0 if defined $self->{'max_uri_len'}
692 0 0 if defined $self->{'wbuf_low_water'}
694 0 0 if defined $self->{'max_h2_concurrent_streams'}
697 0 0 if (my $tls = $self->{'tls'})
698 0 0 if ($f->has_tls)
699 0 0 unless $self->{'_master_socks'}
710 0 20 unless defined $pid
711 0 20 unless ($pid)
713 0 0 unless $self->{'quiet'}
720 0 0 if ($self->{'_use_reuseport'})
722 0 0 unless $self->{'_socks'}
724 0 0 unless (close $old_sock)
734 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 } })
742 0 0 if (my $tls = $self->{'_tls_config'})
749 0 0 if (my $loader = $self->{'_app_loader'})
751 0 0 if ($@)
757 0 0 if (my $cb = $self->{'after_fork'})
761 0 0 if (my $max = $self->{'max_requests_per_worker'})
764 0 0 if ($f->total_requests >= $max)
772 0 0 if $@
773 0 0 $@ ? :
780 0 20 unless $self
781 0 20 unless $self->{'quiet'}
784 20 0 if ($self->{'_shutdown'})
785 3 17 unless ($self->{'_n_kids'})
792 0 0 if ($self->{'_use_reuseport'}) { }
794 0 0 unless $self->{'_socks'}
797 0 0 unless (defined fileno $sock)
802 0 0 if ($all_valid) { }
826 0 3 unless POSIX::setsid()
837 0 3 if ($self->{'_use_reuseport'})
838 0 0 unless $self->{'_socks'}
839 0 0 unless close $sock
851 0 3 if ($self->{'daemonize'}) { }
0 3 elsif (my $file = $self->{'pid_file'}) { }
853 0 0 unless defined $pid
854 0 0 if ($pid)
855 0 0 if (my $file = $self->{'pid_file'})
856 0 0 unless open my $fh, ">", $file
863 0 0 unless open STDIN, "<", "/dev/null"
864 0 0 unless open STDOUT, ">", "/dev/null"
866 0 0 unless $ENV{'FEERSUM_DEBUG'}
868 0 0 unless open my $fh, ">", $file
876 1 4 if (my $group = $self->{'group'})
878 1 0 unless defined $gid
883 0 0 if $!
884 0 0 unless POSIX::setgid($gid)
886 1 3 if (my $user = $self->{'user'})
888 1 0 unless defined $uid
889 0 0 unless POSIX::setuid($uid)
895 3 3 if $self->{'_shutdown'}
898 0 3 unless $self->{'quiet'}
903 3 0 if ($self->{'_n_kids'}) { }