Branch Coverage

blib/lib/Atomic/Pipe.pm
Criterion Covered Total %
branch 257 348 73.8


line true false branch
13 75 0 if (eval { do { require IO::Select; 1 } }) { }
30 75 0 if "Errno"->can("ERESTART")
34 75 0 if "Errno"->can("EWOULDBLOCK")
41 75 0 if ('POSIX'->can('PIPE_BUF') and eval { do { &POSIX::PIPE_BUF() } }) { }
48 75 0 if ('POSIX'->can('SSIZE_MAX') and eval { do { &POSIX::SSIZE_MAX() } }) { }
68 0 0 if ($can_thread and $] == "5.01" and $Atomic::Pipe::Config{'ccname'} eq "gcc" and $Atomic::Pipe::Config{'gccversion'})
70 0 0 if $parts[0] > 4 or $parts[0] == 4 and $parts[1] >= 8
75 75 0 if (not $can_thread) { }
0 0 elsif ($INC{'threads.pm'}) { }
82 0 0 $INC{'threads.pm'} ? :
85 0 75 if ($^O eq 'MSWin32') { }
87 0 0 unless eval { do { require Win32::API; 1 } }
88 0 0 unless eval { do { require Win32API::File; 1 } }
126 24 0 @_ ? :
132 0 0 if @_
138 27 168507 if (@_)
139 0 27 if $_[0] and Deparse error: Can't locate object method "object_2svref" via package "B::SPECIAL" at /usr/local/lib/perl5/5.42.0/B/Deparse.pm line 5762.
140 16 11 $_[0] ? :
141 11 16 unless $_[0]
145 144277 24177 $val ? :
168454 80 defined $val ? :
152 4 6 $_[0]{'keep_compressed'} ? :
157 0 168730 if $self->{'invalid_state'}
159 0 168730 unless my $rh = $self->{'rh'}
161 223 168507 if $self->{'eof'}
169 144341 24166 if ($use_select) { }
172 144055 286 $blocking ? :
173 190 144151 unless @ready
179 0 168317 unless $to_read
184 93 168224 unless (defined $got)
185 93 0 if $NONBLOCK_ERRNO{0 + $!}
186 0 0 if ($RETRY_ERRNO{0 + $!})
187 0 0 unless $use_select
193 168173 51 if ($got) { }
216 168105 5432754 unless ($self->{'in_buffer_size'} and $self->{'in_buffer_size'} >= $size)
218 10 168095 unless ($self->{'in_buffer_size'} >= $size)
219 8 2 unless $params{'eof_invalid'} and $self->{'eof'}
226 5600778 71 if ($params{'remove'}) { }
249 4 6 if (defined(my $path = $self->{'compression_dictionary_file'}))
258 4 6 if (defined(my $path = $self->{'compression_dictionary_file'}))
266 10 39 if ($self->_has_dict)
278 12 39 if ($self->_has_dict) { }
287 6 45 unless defined $out
294 14 516 if $self->{'invalid_state'}
296 72 444 if $self->fill_buffer
297 231 213 unless $self->{'eof'}
298 62 151 if $self->{'in_buffer_size'}
300 151 0 if (my $buffer = $self->{'mixed_buffer'})
301 49 102 if defined $buffer->{'lines'} and length $buffer->{'lines'}
302 1 101 if defined $buffer->{'burst'} and length $buffer->{'burst'}
313 4 4 if $mode == 0
314 4 0 if $mode == 1
333 0 233 if $params{'use_io_select'} and Deparse error: Can't locate object method "object_2svref" via package "B::SPECIAL" at /usr/local/lib/perl5/5.42.0/B/Deparse.pm line 5762.
335 41 192 if (defined(my $algo = $params{'compression'}))
336 4 37 unless $algo eq "zstd"
338 0 37 unless eval { do { require Compress::Zstd; 1 } }
342 2 227 if defined $params{'compression_dictionary'} and defined $params{'compression_dictionary_file'}
346 4 223 if defined $params{'compression_dictionary'} || defined $params{'compression_dictionary_file'} and not defined $params{'compression'}
354 0 22 unless -p $fifo
356 0 22 unless open my $fh, "+<", $fifo
367 0 13 unless -p $fifo
369 0 13 unless open my $fh, ">", $fifo
380 10 4 if @_ and not ref $_[0] and $MODE_TO_DIR{$_[0]}
386 0 13 unless -p $ifh
391 0 13 unless open my $fh, $mode, $ifh
404 0 11 unless open my $fh, $mode, $fd
406 0 11 unless -p $fh
418 119 264 if $mixed
430 0 4 unless pipe $rh, $wh
445 0 160 unless pipe $rh, $wh
459 0 119 if $self->{'invalid_state'}
461 60 59 if $self->{'rh'}
472 6 10 unless (defined $algo)
483 2 8 unless $algo eq "zstd"
485 0 8 unless eval { do { require Compress::Zstd; 1 } }
490 2 6 if defined $level
504 4 0 if (defined $bytes) { }
506 0 4 unless defined $self->{'compression'}
521 4 4 if (defined $path) { }
523 0 4 unless defined $self->{'compression'}
538 2 2 $val ? :
564 6 48 if $self->eof and keys %{$$self{'state'}{'buffers'};} || keys %{$$self{'state'}{'parts'};}
566 194 185 if ($buffer->{'lines'} or length $buffer->{'lines'})
571 52 142 if $term
572 24 0 if $self->{'eof'} and not $self->{'in_buffer_size'} and defined $line and length $line
575 4 0 if $params{'peek_line'} and defined $line and length $line
578 43 260 if ($buffer->{'in_message'})
581 1 41 unless (defined $id)
583 0 1 if $self->{'eof'} and not $self->{'in_buffer_size'}
587 0 1 if $self->{'eof'} or $self->{'in_buffer_size'} > $before
597 15 26 if (defined $message)
598 4 11 if ($self->{'compression'})
602 2 2 if $self->{'keep_compressed'}
609 38 248 if ($buffer->{'strip_term'})
612 0 38 unless $term eq $postfix
616 71 215 if ($buffer->{'in_burst'})
619 42 29 if ($peek eq $key)
631 20 9 if ($term) { }
635 8 12 if ($self->{'compression'})
638 2 6 if $self->{'keep_compressed'}
647 8 1 if $self->{'eof'}
650 97 119 unless ($self->{'in_buffer_size'} or $self->fill_buffer)
651 4 93 if $peek and not $self->{'eof'}
653 39 54 unless $self->{'eof'}
656 24 30 if $buffer->{'eof'}++
665 119 0 if defined $linedata
667 71 48 if ($buffer->{'in_burst'}) { }
695 0 0 if $ret == 0
710 0 0 $state ? :
719 0 81 unless my $rh = $self->{'rh'}
721 81 0 if @_
732 0 24 unless my $wh = $self->{'wh'}
734 0 24 unless @_
744 0 24 unless defined $flags
745 5 19 if ($val) { }
747 0 24 unless fcntl $wh, &Fcntl::F_SETFL, $flags
756 18 22 if ($self->{'rh'} and not $self->{'wh'}) { }
21 1 elsif ($self->{'wh'} and not $self->{'rh'}) { }
766 0 1 if $r and $w
767 1 0 unless $r or $w
773 0 2 unless defined &Fcntl::F_GETPIPE_SZ
782 0 10 unless defined &Fcntl::F_SETPIPE_SZ
793 0 3 unless -e "/proc/sys/fs/pipe-max-size"
795 0 3 unless open my $max, "<", "/proc/sys/fs/pipe-max-size"
814 9 0 if $self->{'rh'} and not $self->{'wh'}
820 8 0 if $self->{'wh'} and not $self->{'rh'}
827 0 6 unless open my $fh, ">&:raw", $self->{'wh'}
834 0 0 unless open my $fh, "<&:raw", $self->{'rh'}
841 0 0 unless $self->{'wh'}
843 0 0 unless $self->{'rh'}
852 0 3 unless $self->{'rh'}
854 0 3 unless $self->{'wh'}
866 0 48 if $self->{'hit_epipe'} or $self->{'invalid_state'}
867 2 46 if $self->pending_output
872 45 2 if ($self->{'wh'})
876 2 45 if $self->{'rh'}
884 0 110 if defined $_[0]{'delimiter_size'}
894 1 12 if $cache and $cache->[0] eq $data
905 5 8 if $self->{'compression'}
908 2 11 unless $size <= 4096
917 8 19757 if $self->{'compression'}
920 2 19763 unless $size <= 4096
931 26 360 if $self->{'hit_epipe'} or $self->{'invalid_state'}
932 2 358 if $self->{'wh'} and $self->pending_output
937 99 19847 unless my $buffer = $self->{'out_buffer'}
938 19838 9 unless @$buffer
953 233 819986 unless $blocking or defined $got
954 2 819984 unless defined $got
966 0 820223 unless my $wh = $self->{'wh'}
968 2 820221 if $self->{'hit_epipe'}
973 23 820198 if length $prefix or length $postfix
980 237 819984 unless (defined $wrote)
981 2 235 if ($! == 32 or 0)
986 233 2 if $NONBLOCK_ERRNO{0 + $!} or 0
987 0 2 if $RETRY_ERRNO{0 + $!}
991 0 819984 unless $wrote
992 819984 0 if $wrote == $size
1002 0 95 if defined $self->{'adjusted_dsize'}
1016 33 200092 if $self->{'compression'}
1024 200125 0 if $dtotal % $adjusted_dsize
1029 78 200047 if ($parts == 1) { }
1034 5 73 $message_key ? :
1060 6 700173 unless defined $id
1062 700142 31 unless $self->{'compression'}
1064 4 27 if ($params{'debug'})
1067 2 2 if $self->{'keep_compressed'}
1074 2 23 if $self->{'keep_compressed'} and wantarray
1085 2800357 1 unless ($state->{'key'})
1087 7 2800350 unless (defined $key_bytes and length $key_bytes)
1092 1 1 if $self->{'eof'} and $self->{'in_buffer_size'}
1108 2100154 700194 $state->{'buffers'}{$tag} ? :
1112 2100160 700188 unless ($id == 0)
1113 26 2100134 if $params{'one_part_only'}
1120 700175 13 unless $params{'debug'}