Branch Coverage

lib/Rex/Commands/Fs.pm
Criterion Covered Total %
branch 33 144 22.9


line true false branch
101 11 3 if ($fs->is_symlink($to) and $fs->readlink($to) eq $from) { }
105 0 3 unless $fs->ln($from, $to)
140 0 7 if (ref $files[0] eq 'ARRAY') { }
147 7 0 if (scalar @{$f;} == 1) { }
154 7 0 if ($fs->is_file($file) or $fs->is_symlink($file)) { }
158 7 0 unless ($file =~ m(^\Q$tmp_path\E[/\\][a-z]+\.tmp$)u)
208 0 2 if (ref $dirs[0] eq 'ARRAY') { }
215 2 0 if (scalar @{$d;} == 1) { }
222 0 2 if (not $fs->is_dir($dir) || $dir =~ /[\*\[]/u) { }
227 0 2 if ($fs->is_dir($dir))
302 0 5 if ($fs->is_dir($dir))
312 0 5 if ($not_recursive) { }
313 0 0 unless ($fs->mkdir($dir))
318 0 0 if $owner
319 0 0 if $group
320 0 0 if $mode
323 2 3 unless ("Rex::Helper::File::Spec"->file_name_is_absolute($dir))
333 5 0 unless (is_dir($path_so_far) or is_file($path_so_far))
334 0 5 unless ($fs->mkdir($path_so_far))
339 0 5 if $owner
340 0 5 if $group
341 5 0 if $mode
348 5 0 unless ($not_created)
354 0 5 if (%old_stat and $old_stat{'uid'} != $new_stat{'uid'})
360 0 5 if (%old_stat and $old_stat{'gid'} != $new_stat{'gid'})
366 0 5 if (%old_stat and $old_stat{'mode'} ne $new_stat{'mode'})
372 0 5 if ($changed == 0) { }
410 0 0 unless $fs->chown($user, $file, @opts)
434 0 0 unless $fs->chgrp($group, $file, @opts)
458 0 5 unless $fs->chmod($mode, $file, @opts)
482 0 0 if ($fs->is_file($old) or $fs->is_dir($old) or $fs->is_symlink($old))
488 0 0 unless ($fs->rename($old, $new))
494 0 0 if ($fs->is_file($new) or $fs->is_dir($new) or $fs->is_symlink($new))
499 0 0 unless ($fs->is_file($old) or $fs->is_dir($old) or $fs->is_symlink($old))
503 0 0 if ($old_present == 1 and $new_present == 1 and $old_absent == 1) { }
546 0 0 if ($fs->is_file($source) and $fs->is_dir($dest))
550 0 0 if ($fs->is_file($dest) or $fs->is_dir($dest) or $fs->is_symlink($dest))
554 0 0 unless ($fs->cp($source, $dest))
558 0 0 if ($new_present == 0) { }
645 1 6 if not defined $stat[0] and scalar @stat == 1
647 0 6 if (scalar @stat % 2)
820 0 0 unless ($link)
882 0 0 if ($dev)
883 0 0 if (keys %$ret == 1)
904 6 1 if $fs
906 1 6 unless ($size)
979 0 0 if (defined $option->{'fs'})
985 0 0 if (not defined $option->{'type'}) { }
1003 0 0 if ($option->{'ensure'} eq 'absent') { }
1009 0 0 exists $option->{'on_change'} ? :
1012 0 0 if ($option->{'ensure'} eq "persistent")
1022 0 0 if ($already_mounted)
1031 0 0 $option->{'type'} ? :
0 0 $option->{'options'} ? :
1037 0 0 unless ($already_mounted)
1039 0 0 if ($? != 0)
1047 0 0 if (exists $option->{'persistent'})
1048 0 0 unless (exists $option->{'type'})
1065 0 0 unless ($fh->open("<", "/etc/fstab"))
1078 0 0 if (ref $option->{'options'} eq 'ARRAY') { }
1080 0 0 if ($option->{'label'}) { }
1092 0 0 if ($option->{'label'}) { }
1107 0 0 unless ($fh->open(">", "/etc/fstab"))
1118 0 0 if ($new_md5 ne $old_md5)
1125 0 0 if ($changed == 1)
1126 0 0 if (exists $option->{'on_change'} and ref $option->{'on_change'} eq "CODE")
1151 0 0 if (exists $option{'device'})
1165 0 0 if ($device) { }
1172 0 0 if ($already_mounted)
1174 0 0 if ($? != 0)
1178 0 0 if ($changed)
1179 0 0 if (exists $option{'on_change'} and ref $option{'on_change'} eq "CODE")