Branch Coverage

blib/lib/Test/SSH/Backend/Base.pm
Criterion Covered Total %
branch 30 168 17.8


line true false branch
27 0 4 if (defined(my $uri_txt = $sshd->{'requested_uri'}))
29 0 0 unless defined $uri->scheme
30 0 0 if ($uri->scheme ne 'ssh')
37 0 0 if defined $v
40 0 0 unless $opts{'c_params'}
41 0 0 if (/^key_path=(.*)$/)
57 22 9 if (defined(my $fhs = $sshd->{'log_fhs'}))
76 0 0 if ($sshd->_is_server_running)
79 0 0 if ($auth_method eq 'publickey') { }
0 0 elsif ($auth_method eq 'password') { }
114 0 2 if (defined $sshd->{'_ssh_executable'})
124 0 24 if (-f $fn)
126 0 0 unless (-x $fn)
130 0 0 unless (-B $fn)
134 0 0 unless wantarray
145 0 2 if defined $sshd->{$slot}
146 2 0 if (defined $version_flags) { }
150 0 0 if (defined $out)
151 0 0 if (my($ver, $mayor) = $out =~ /^(OpenSSH[_\-](\d+)\.\d+(?:\.\d+)?(?:p\d+))/m)
152 0 0 if (not defined $min_version or $mayor >= $min_version) { }
169 0 2 if (defined(my $bin = $sshd->{$slot})) { }
183 32 0 if (defined $dir)
184 17 15 if -d $dir
185 15 0 if (mkdir $dir, 448 and -d $dir)
198 0 8 unless $sshd->_mkdir($pdir)
200 8 0 if (defined $subdir)
203 4 24 if (defined $sshd->{$slot}) { }
208 0 24 unless $sshd->_mkdir($pdir)
218 8 0 ref $sshd ? :
219 8 0 if (my($be) = $class =~ /\b(\w+)$/)
228 4 6 unless (defined $sshd->{'run_dir'})
240 4 0 unless (defined $sshd->{$slot})
243 0 4 unless (open $wfh, '>>', $fn)
247 0 4 unless (open $rfh, '<', $fn)
254 4 0 $write ? :
270 0 0 ref $_[0] ? :
277 0 0 if (delete $opts{'search_binary'})
278 0 0 if (my $method = $sshd->can("$cmd[0]_executable") || $sshd->can("_$cmd[0]_executable"))
280 0 0 unless defined $cmd[0]
287 0 0 unless my $out_fh = $sshd->_write_fh($out_fn)
292 0 0 if ($^O =~ /^MSWin/) { }
293 0 0 if (defined $password)
300 0 0 unless open STDIN, '<', $dev_null
301 0 0 unless open STDOUT, '>>&', $out_fh
302 0 0 unless open STDOUT, '>>&', *STDOUT
304 0 0 delete $opts{'async'} ? :
307 0 0 if $@
312 0 0 if (defined $password)
313 0 0 unless (eval { do { require IO::Pty; 1 } })
321 0 0 unless ($pid)
322 0 0 unless (defined $pid)
327 0 0 if $pty
329 0 0 unless open my $out2, '>>&', $out_fh
330 0 0 unless POSIX::dup2(fileno $in, 0)
331 0 0 unless POSIX::dup2(fileno $out2, 1)
332 0 0 unless POSIX::dup2(1, 2)
335 0 0 if $@
338 0 0 if (delete $opts{'async'}) { }
339 0 0 wantarray ? :
346 0 0 if (time > $end)
347 0 0 time - $end > 3 ? :
349 0 0 if (waitpid($pid, 1) > 0)
350 0 0 if ($?)
356 0 0 if ($pty)
359 0 0 if (select($rv, undef, undef, 0) > 0)
361 0 0 if ($buffer =~ s/.*[>:?]\s*$//s)
376 0 0 unless defined $name
386 0 0 if (defined $sshd->{'requested_uri'} or $sshd->_run_cmd($cmd))
387 0 0 if ($sshd->_run_remote_cmd($cmd))
404 0 0 if ($auth_method eq 'password') { }
0 0 elsif ($auth_method eq 'publickey') { }
405 0 0 $opts{'hidden_password'} ? :
415 0 0 if (wantarray) { }
417 0 0 $sshd->{'auth_method'} eq 'password' ? :
429 0 0 unless (defined $sshd->{'server_version'})
434 0 0 if (my $socket = 'IO::Socket::INET'->new('PeerAddr', $sshd->{'host'}, 'PeerPort', $sshd->{'port'}, 'Timeout', $sshd->{'timeout'}, 'Proto', 'tcp', 'Blocking', 0)) { }
442 0 0 if (select($rv, undef, undef, 1) > 0)
443 0 0 unless sysread $socket, $buffer, 1024, length $buffer
446 0 0 if ($buffer =~ /^(.*)\n/) { }
462 0 0 unless (defined $sshd->{'server_os'})
469 4 0 if (opendir my $dh, $dir)
471 8 4 if $entry eq $up_dir or $entry eq $cur_dir
483 4 0 if (defined(my $run_dir = $sshd->_run_dir))
484 4 0 if (defined(my $last = $sshd->_run_dir_last))