Branch Coverage

blib/lib/Nginx/Test.pm
Criterion Covered Total %
branch 58 134 43.2


line true false branch
128 16 0 if -f $_ and -x $_
144 0 0 if (-f "$_/objs/nginx-perl" and -x "$_/objs/nginx-perl")
149 0 0 unless $x =~ m[^/|^\./]
164 0 0 if -f $_ and -x $_
187 0 21 unless my $sock = 'IO::Socket::INET'->new('Listen', 5, 'LocalAddr', '127.0.0.1', 'LocalPort', $port, 'Proto', 'tcp', 'ReuseAddr', 1)
229 33 15 unless ($sock)
283 4 30 if (-e $_)
294 84 18 unless (-e $_)
295 0 84 unless mkdir $_
303 0 34 unless open my $fh, '>', "$_/.exists"
309 0 17 unless open my $fh, '>', "$dir/html/index.html"
317 0 17 unless opendir my $d, "$dir/logs"
320 8 34 if $_ ne '.' and $_ ne '..' and $_ ne '.exists'
338 0 17 unless ($conf =~ /events/)
341 0 17 unless ($conf =~ /error_log/)
344 0 17 unless ($conf =~ /master_process/)
347 0 17 unless ($conf =~ /daemon/)
350 0 17 unless ($conf =~ /worker_processes/)
354 0 17 unless open my $fh, '>', "$dir/conf/nginx-perl.conf"
374 0 0 unless -e $fullpath
377 0 13 unless open my $fh, '>', "$fullpath/$name.pm"
400 0 0 unless opendir my $d, "$dir/logs"
403 0 0 if $_ ne '.' and $_ ne '..' and $_ ne '.exists'
454 9 0 unless ($Nginx::Test::Child::IS_CHILD)
455 9 0 if ($$self)
470 0 17 unless defined $pid
473 8 9 if ($pid == 0)
476 0 8 unless open STDOUT, '>', "$path/logs/stdout.log"
479 0 8 unless open STDERR, '>', "$path/logs/stderr.log"
482 0 0 unless exec $nginx, '-p', $path
507 0 0 unless defined $pid
510 0 0 if ($pid == 0)
539 0 1 unless open my $fh, '-|', "$nginx -V 2>&1"
571 0 7 unless my $sock = 'IO::Socket::INET'->new('Proto', 'tcp', 'PeerAddr', $peer)
607 0 7 $@ ? :
7 0 wantarray ? :
625 17 0 unless ($path =~ m[^/])
630 170 51 m[^/] ? :
672 0 7 unless my $port = &get_unused_port()
757 162 0 if (not $@) { }
780 0 52 unless my $sock = 'IO::Socket::INET'->new('PeerAddr', $peer)
850 0 0 if ($$buf =~ /(\x0d\x0a\x0d\x0a)/gs or $$buf =~ /(\x0a\x0a)/gs) { }
859 0 0 if @lines < 1
877 0 0 if ($h{'_version'} eq 'HTTP/1.1') { }
0 0 elsif (exists $h{'connection'}) { }
878 0 0 if (not exists $h{'connection'}) { }
0 0 elsif (not $h{'connection'}[0] =~ /[Cc]lose/) { }
884 0 0 if ($h{'connection'}[0] =~ /[Kk]eep-[Aa]live/)
933 103 0 if ($$buf =~ /(\x0d\x0a\x0d\x0a)/gs or $$buf =~ /(\x0a\x0a)/gs) { }
942 0 103 if @lines < 1
960 103 0 if ($h{'_version'} eq 'HTTP/1.1') { }
0 0 elsif (exists $h{'connection'}) { }
961 3 100 if (not exists $h{'connection'}) { }
3 97 elsif (not $h{'connection'}[0] =~ /[Cc]lose/) { }
967 0 0 if ($h{'connection'}[0] =~ /[Kk]eep-[Aa]live/)
997 34 0 if ($$buf =~ /(\x0d\x0a\x0d\x0a)/gs) { }
1014 6 28 if (length($$buf) - $header_len - $sep_len > 0) { }
1015 6 0 if (not exists $h{'content-length'}) { }
1052 0 55 unless &parse_http_response($$buf, $$h)
1056 55 0 $$h->{'content-length'} ? :
1058 52 3 if ($len)
1083 0 10 if @dirs and $dirs[-1] eq ''
1088 20 0 if ($dir)
1089 10 10 unless (-e $dir)
1090 0 10 unless mkdir $dir
1114 0 0 unless opendir my $d, $dir
1117 0 0 if $_ ne '.' and $_ ne '..' and $_ ne '.exists'