Branch Coverage

blib/lib/Feersum/Runner.pm
Criterion Covered Total %
branch 90 364 24.7


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 20 if ($INSTANCE)
40 0 2 if $Feersum::Runner::INSTANCE->{'running'}
51 2 21 if $self->{'_cleaned_up'}
53 6 15 if (my $f = $self->{'endjinn'})
59 0 21 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'})
232 170 0 $consume ? :
233 2 168 if defined $val
235 10 0 if ($f->can("max_h2_concurrent_streams"))
237 10 0 $consume ? :
238 0 10 if defined $v
248 0 0 unless my $max = $self->{'max_requests_per_worker'}
250 0 0 if ($f->total_requests >= $max)
263 0 0 if ($sni)
264 0 0 unless ref $sni eq "ARRAY"
275 0 13 if (defined $self->{'listen'} and not ref $self->{'listen'})
281 0 13 if ref $self->{'listen'} ne "ARRAY"
283 0 13 if @{$self->{'listen'};} == 0
295 10 3 if (not $self->{'tls'}) { }
296 2 8 if (my $cert = delete $self->{'tls_cert_file'}) { }
1 7 elsif (delete $self->{'tls_key_file'}) { }
298 1 1 unless my $key = delete $self->{'tls_key_file'}
308 4 7 if (my $tls = $self->{'tls'}) { }
1 6 elsif (delete $self->{'h2'}) { }
309 0 4 unless ref $tls eq "HASH"
310 0 4 unless $tls->{'cert_file'}
311 0 4 unless $tls->{'key_file'}
313 1 3 if delete $self->{'h2'}
326 3 10 if ($self->{'pre_fork'})
328 0 3 if (not $n =~ /^\d+$/ or $n < 1)
331 0 3 if ($n > 1000)
344 2 0 if ($self->{'epoll_exclusive'} and $self->{'pre_fork'} and $^O eq "linux")
360 31 5 unless defined $val
361 0 5 unless $val =~ /^-?\d+$/
362 3 2 if $val < -2 or $val > 2
364 0 10 if (defined(my $val = $self->{'max_accept_per_loop'}))
365 0 0 unless $val =~ /^\d+$/ and $val > 0
368 0 10 if (defined(my $val = $self->{'max_connections'}))
369 0 0 unless $val =~ /^\d+$/
379 2 6 if (my $tls = delete $self->{'tls'})
380 2 0 unless -f $tls->{'cert_file'} and -r _
382 0 0 unless -f $tls->{'key_file'} and -r _
385 0 0 if ($f->has_tls) { }
388 0 0 unless $self->{'quiet'}
402 0 3 if (my $log_cb = $self->{'access_log'})
424 0 3 unless $self->{'quiet'}
430 0 3 if ($self->{'hot_restart'})
431 0 0 unless $self->{'app_file'}
443 0 3 if ($self->{'pre_fork'} and defined $self->{'preload_app'} and not $self->{'preload_app'}) { }
446 0 0 if (not $a and $self->{'app_file'})
449 0 0 if $@ or not $a
451 0 0 unless $a
459 0 0 if $self
463 3 0 if (not $app and $self->{'app_file'})
466 0 3 if $@
467 0 3 if $! and not defined $app
468 0 3 unless $app
471 0 3 unless $app
475 6 0 if $self
477 3 0 if $self->{'pre_fork'}
480 0 3 unless $self->{'quiet'}
492 0 0 unless $quiet
530 0 0 unless defined $pid
532 0 0 if ($pid == 0)
535 0 0 unless $quiet
544 0 0 if ($self->{'epoll_exclusive'} and $self->{'pre_fork'} and $^O eq "linux" and $f->can("set_epoll_exclusive"))
561 0 0 if ($@ or not $app or ref $app ne "CODE")
572 0 0 if ($self->{'pre_fork'})
584 0 0 if ($self->{'pre_fork'})
590 0 0 unless POSIX::setsid()
598 0 0 unless ($self->{'pre_fork'})
599 0 0 if $self->{'after_fork'}
607 0 0 $self->{'pre_fork'} ? :
0 0 unless $quiet
617 0 0 unless (_wait_for_ready($pending_pid, $quiet, $gen, \$shutting_down, $startup_timeout))
618 0 0 if kill 0, $pending_pid
625 0 0 unless $quiet
628 0 0 if $shutting_down or $pending_pid
629 0 0 unless $quiet
634 0 0 if (_wait_for_ready($pending_pid, $quiet, $gen, \$shutting_down, $startup_timeout)) { }
635 0 0 unless $quiet
638 0 0 if $old_pid
641 0 0 if kill 0, $pending_pid
648 0 0 if $shutting_down
650 0 0 unless $quiet
651 0 0 if $current_pid
654 0 0 if $pending_pid
658 0 0 if $shutting_down
660 0 0 unless $quiet
661 0 0 if $current_pid
662 0 0 if $pending_pid
669 0 0 unless $quiet
671 0 0 if $pending_pid and $kid == $pending_pid
672 0 0 if ($current_pid and $kid == $current_pid)
674 0 0 if $shutting_down
675 0 0 unless ($shutting_down or $pending_pid)
678 0 0 if (_wait_for_ready($pending_pid, $quiet, $gen, \$shutting_down, $startup_timeout)) { }
683 0 0 if kill 0, $pending_pid
696 0 0 unless $quiet
728 0 0 $self->{'epoll_exclusive'} && $self->{'pre_fork'} ? :
0 0 if defined $self->{'epoll_exclusive'} and $f->can("set_epoll_exclusive")
731 0 0 if (my $tls = $self->{'tls'})
732 0 0 if ($f->has_tls) { }
733 0 0 unless $self->{'_master_socks'}
750 0 20 unless defined $pid
751 0 20 unless ($pid)
753 0 0 unless $self->{'quiet'}
760 0 0 if ($self->{'_use_reuseport'})
762 0 0 unless $self->{'_socks'}
764 0 0 unless (close $old_sock)
774 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 } })
782 0 0 if (my $tls = $self->{'_tls_config'})
789 0 0 if (my $loader = $self->{'_app_loader'})
791 0 0 if ($@)
797 0 0 if (my $cb = $self->{'after_fork'})
802 0 0 if $@
803 0 0 $@ ? :
810 0 20 unless $self
811 0 20 unless $self->{'quiet'}
814 20 0 if ($self->{'_shutdown'})
815 3 17 unless ($self->{'_n_kids'})
822 0 0 if ($self->{'_use_reuseport'}) { }
824 0 0 unless $self->{'_socks'}
827 0 0 unless (defined fileno $sock)
832 0 0 if ($all_valid) { }
856 0 3 unless POSIX::setsid()
867 0 3 if ($self->{'_use_reuseport'})
868 0 0 unless $self->{'_socks'}
869 0 0 unless close $sock
881 0 3 if ($self->{'daemonize'}) { }
0 3 elsif (my $file = $self->{'pid_file'}) { }
883 0 0 unless defined $pid
884 0 0 if ($pid)
885 0 0 if (my $file = $self->{'pid_file'})
886 0 0 unless open my $fh, ">", $file
893 0 0 unless open STDIN, "<", "/dev/null"
894 0 0 unless open STDOUT, ">", "/dev/null"
896 0 0 unless $ENV{'FEERSUM_DEBUG'}
898 0 0 unless open my $fh, ">", $file
906 1 4 if (my $group = $self->{'group'})
908 1 0 unless defined $gid
913 0 0 if $!
914 0 0 unless POSIX::setgid($gid)
918 0 0 unless @rg == 1 and $rg[0] == $gid
921 1 3 if (my $user = $self->{'user'})
923 1 0 unless defined $uid
924 0 0 unless POSIX::setuid($uid)
926 0 0 unless $< == $uid and $> == $uid
933 3 3 if $self->{'_shutdown'}
936 0 3 unless $self->{'quiet'}
941 3 0 if ($self->{'_n_kids'}) { }