Branch Coverage

blib/lib/Feersum/Runner.pm
Criterion Covered Total %
branch 98 380 25.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 22 if ($INSTANCE)
40 0 2 if $Feersum::Runner::INSTANCE->{'running'}
51 2 23 if $self->{'_cleaned_up'}
53 6 17 if (my $f = $self->{'endjinn'})
59 0 23 if (my $file = $self->{'pid_file'})
60 0 0 if -f $file
75 0 13 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 13 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 13 0 if ($listen =~ /:(\d+)$/) { }
0 0 elsif ($listen =~ /:(\S+)$/) { }
166 0 13 if $port > 65535
169 0 0 unless $port =~ /^\d+$/
178 0 13 unless $sock
217 170 0 $consume ? :
218 2 168 if defined $val
220 10 0 if ($f->can("max_h2_concurrent_streams"))
222 10 0 $consume ? :
223 0 10 if defined $v
233 0 0 unless my $max = $self->{'max_requests_per_worker'}
235 0 0 if ($f->total_requests >= $max)
248 0 0 if ($sni)
249 0 0 unless ref $sni eq "ARRAY"
260 0 14 if (defined $self->{'listen'} and not ref $self->{'listen'})
266 0 14 if ref $self->{'listen'} ne "ARRAY"
268 0 14 if @{$self->{'listen'};} == 0
280 11 3 if (not $self->{'tls'}) { }
281 2 9 if (my $cert = delete $self->{'tls_cert_file'}) { }
1 8 elsif (delete $self->{'tls_key_file'}) { }
283 1 1 unless my $key = delete $self->{'tls_key_file'}
293 4 8 if (my $tls = $self->{'tls'}) { }
1 7 elsif (delete $self->{'h2'}) { }
294 0 4 unless ref $tls eq "HASH"
295 0 4 unless $tls->{'cert_file'}
296 0 4 unless $tls->{'key_file'}
298 1 3 if delete $self->{'h2'}
305 1 10 if $self->{'sni'} and not $self->{'tls'}
315 3 10 if ($self->{'pre_fork'})
317 0 3 if (not $n =~ /^\d+$/ or $n < 1)
320 0 3 if ($n > 1000)
333 2 0 if ($self->{'epoll_exclusive'} and $self->{'pre_fork'} and $^O eq "linux")
340 1 12 if (defined $self->{'accept_priority'} and $f->can("accept_priority"))
342 0 1 unless $val =~ /^-?\d+$/
343 1 0 if $val < -2 or $val > 2
359 29 4 unless defined $val
360 0 4 unless $val =~ /^-?\d+$/
361 2 2 if $val < -2 or $val > 2
363 0 10 if (defined(my $val = $self->{'max_accept_per_loop'}))
364 0 0 unless $val =~ /^\d+$/ and $val > 0
367 0 10 if (defined(my $val = $self->{'max_connections'}))
368 0 0 unless $val =~ /^\d+$/
378 2 6 if (my $tls = delete $self->{'tls'})
379 2 0 unless -f $tls->{'cert_file'} and -r _
381 0 0 unless -f $tls->{'key_file'} and -r _
384 0 0 if ($f->has_tls) { }
387 0 0 unless $self->{'quiet'}
401 0 3 if (my $log_cb = $self->{'access_log'})
423 0 3 unless $self->{'quiet'}
427 0 3 if ($self->{'hot_restart'})
428 0 0 unless $self->{'app_file'}
440 0 3 if ($self->{'pre_fork'} and defined $self->{'preload_app'} and not $self->{'preload_app'}) { }
443 0 0 if (not $a and $self->{'app_file'})
446 0 0 if $@ or not $a
448 0 0 unless $a
456 0 0 if $self
460 3 0 if (not $app and $self->{'app_file'})
463 0 3 if $@
464 0 3 if $! and not defined $app
465 0 3 unless $app
468 0 3 unless $app
472 6 0 if $self
474 3 0 if $self->{'pre_fork'}
477 0 3 unless $self->{'quiet'}
489 0 1 unless $quiet
496 1 0 if ($self->{'pre_fork'})
498 1 0 if (not $n =~ /^\d+$/ or $n < 1)
501 0 0 if ($n > 1000)
540 0 0 unless defined $pid
542 0 0 if ($pid == 0)
545 0 0 unless $quiet
554 0 0 if ($self->{'epoll_exclusive'} and $self->{'pre_fork'} and $^O eq "linux" and $f->can("set_epoll_exclusive"))
560 0 0 if (defined $self->{'accept_priority'} and $f->can("accept_priority"))
576 0 0 if ($@ or not $app or ref $app ne "CODE")
587 0 0 if $self->{'_shutdown'}
592 0 0 if ($self->{'_n_kids'}) { }
613 0 0 if ($self->{'pre_fork'})
619 0 0 unless POSIX::setsid()
627 0 0 unless ($self->{'pre_fork'})
628 0 0 if $self->{'after_fork'}
636 0 0 $self->{'pre_fork'} ? :
0 0 unless $quiet
646 0 0 unless (_wait_for_ready($pending_pid, $quiet, $gen, \$shutting_down, $startup_timeout))
647 0 0 if kill 0, $pending_pid
654 0 0 unless $quiet
657 0 0 if $shutting_down or $pending_pid
658 0 0 unless $quiet
663 0 0 if (_wait_for_ready($pending_pid, $quiet, $gen, \$shutting_down, $startup_timeout)) { }
664 0 0 unless $quiet
667 0 0 if $old_pid
670 0 0 if kill 0, $pending_pid
677 0 0 if $shutting_down
679 0 0 unless $quiet
680 0 0 if $current_pid
683 0 0 if $pending_pid
687 0 0 if $shutting_down
689 0 0 unless $quiet
690 0 0 if $current_pid
691 0 0 if $pending_pid
698 0 0 unless $quiet
700 0 0 if $pending_pid and $kid == $pending_pid
701 0 0 if ($current_pid and $kid == $current_pid)
703 0 0 if $shutting_down
704 0 0 unless ($shutting_down or $pending_pid)
707 0 0 if (_wait_for_ready($pending_pid, $quiet, $gen, \$shutting_down, $startup_timeout)) { }
712 0 0 if kill 0, $pending_pid
725 0 0 unless $quiet
757 0 0 $self->{'epoll_exclusive'} && $self->{'pre_fork'} ? :
0 0 if defined $self->{'epoll_exclusive'} and $f->can("set_epoll_exclusive")
760 0 0 if (my $tls = $self->{'tls'})
761 0 0 if ($f->has_tls) { }
762 0 0 unless $self->{'_master_socks'}
779 0 20 unless defined $pid
780 0 20 unless ($pid)
782 0 0 unless $self->{'quiet'}
789 0 0 if ($self->{'_use_reuseport'})
791 0 0 unless $self->{'_socks'}
793 0 0 unless (close $old_sock)
803 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 } })
811 0 0 if (my $tls = $self->{'_tls_config'})
818 0 0 if (my $loader = $self->{'_app_loader'})
820 0 0 if ($@)
826 0 0 if (my $cb = $self->{'after_fork'})
831 0 0 if $@
832 0 0 $@ ? :
839 0 20 unless $self
840 0 20 unless $self->{'quiet'}
843 20 0 if ($self->{'_shutdown'})
844 3 17 unless ($self->{'_n_kids'})
851 0 0 if ($self->{'_use_reuseport'}) { }
853 0 0 unless $self->{'_socks'}
856 0 0 unless (defined fileno $sock)
861 0 0 if ($all_valid) { }
885 0 3 unless POSIX::setsid()
896 0 3 if ($self->{'_use_reuseport'})
897 0 0 unless $self->{'_socks'}
898 0 0 unless close $sock
910 0 3 if ($self->{'daemonize'}) { }
0 3 elsif (my $file = $self->{'pid_file'}) { }
912 0 0 unless defined $pid
913 0 0 if ($pid)
914 0 0 if (my $file = $self->{'pid_file'})
915 0 0 unless open my $fh, ">", $file
922 0 0 unless open STDIN, "<", "/dev/null"
923 0 0 unless open STDOUT, ">", "/dev/null"
925 0 0 unless $ENV{'FEERSUM_DEBUG'}
927 0 0 unless open my $fh, ">", $file
935 1 4 if (my $group = $self->{'group'})
937 1 0 unless defined $gid
946 0 0 if $!
947 0 0 unless POSIX::setgid($gid)
955 0 0 unless @rg and not grep({$_ != $gid;} @rg)
957 1 3 if (my $user = $self->{'user'})
959 1 0 unless defined $uid
960 0 0 unless POSIX::setuid($uid)
962 0 0 unless $< == $uid and $> == $uid
969 3 3 if $self->{'_shutdown'}
972 0 3 unless $self->{'quiet'}
977 3 0 if ($self->{'_n_kids'}) { }