Branch Coverage

blib/lib/StorageDisplay/Collect.pm
Criterion Covered Total %
branch 241 390 61.7


line true false branch
39 0 91 unless $collector->isa("StorageDisplay::Collect::Collector")
44 0 112 if (exists $self->{'_attr_collectors_by_provide'}{$cn})
83 7 0 if (ref $reader eq "")
111 190 304 unless exists $info->{$entry}
112 190 114 if (ref $info->{$entry} eq "")
142 0 56 if (not defined $state) { }
56 0 elsif ($collector_state->{$cname} == 1) { }
144 0 0 unless defined $collector
158 2 89 if (scalar @missing_files)
164 75 14 $col->depends('root') ? :
175 15 74 if (scalar @missing_progs)
235 8 1 unless (defined $has_boolean_values)
245 9 0 if ($has_boolean_values) { }
267 0 0 if (not $ref_type) { }
0 0 elsif ($ref_type eq 'HASH') { }
0 0 elsif ($ref_type eq 'ARRAY') { }
0 0 elsif ($ref_type eq 'JSON::PP::Boolean') { }
0 0 elsif ($ref_type eq 'Math::BigInt') { }
0 0 elsif ($ref_type eq 'Math::BigFloat') { }
277 0 0 $_[0] ? :
280 0 0 if ($_[0]->beq($_[0]->numify))
287 0 0 if ($_[0]->is_int and $_[0]->beq($_[0]->numify))
308 8 60 unless (defined $json_parser)
348 108 3568 unless ($s =~ m[^[0-9a-zA-Z_\@,:/=-]+$])
377 0 0 unless open $dh, "<", $filename
399 0 0 unless open my $dh, "-|", @cmd
406 0 0 if ($> != 0) { }
426 0 0 unless open my $dh, "-|", @cmd
433 0 0 if ($> != 0) { }
451 0 0 unless (exists $args{'recorder-reader'})
455 0 0 if (ref $reader eq "")
459 0 0 unless builtin::blessed($reader) and $reader->isa("StorageDisplay::Collect::CMD")
489 0 0 if (scalar @infos)
616 180 89 wantarray ? :
720 0 14 if ($@)
762 11020 87228 if ($line eq '') { }
763 1535 9485 if (defined $dname) { }
764 1535 0 if (exists $data->{'names'})
775 11020 76208 if ($line =~ /^P: (.*)$/) { }
1535 74673 elsif ($line =~ /^N: (.*)$/) { }
1101 73572 elsif ($line =~ /^S: (.*)$/) { }
284 73288 elsif ($line =~ /^E: (DEVLINKS)=(.*)$/) { }
59305 13983 elsif ($line =~ /^E: ([^=]*)=(.*)$/) { }
13983 0 elsif ($line =~ /^[MRUTDILQV]: .*$/) { }
790 0 0 defined $dname ? :
795 0 7 if (defined $dname)
832 4 400 if $line eq "No devices found"
833 80 320 if ($line =~ /^DM_/)
834 75 5 if (defined $dname) { }
842 400 0 if ($line =~ /^ ?(DM_[^=]*)='(.*)'$/) { }
843 337 63 if ($2 ne "")
846 80 320 if ($1 eq "DM_BLKDEVNAME")
850 0 0 defined $dname ? :
853 5 2 if (defined $dname)
882 0 233 unless defined $udev_info
883 71 162 if (($udev_info->{'_udev_infos'}{'DEVTYPE'} // "") ne "disk")
886 112 50 if (($udev_info->{'_udev_infos'}{'ID_PART_TABLE_TYPE'} // "") eq "")
887 4 108 if (($lsblk_info->{'rm'} // 0) == 1)
891 47 61 if (($lsblk_info->{'type'} // "") eq "loop" and ($lsblk_info->{'size'} // 0) == 0)
896 45 16 if (($lsblk_info->{'type'} // "") eq "lvm")
904 0 7 if (($udev_info->{'_udev_infos'}{'ID_PART_TABLE_TYPE'} // "") eq "dos" and ($udev_info->{'_udev_infos'}{'ID_PART_ENTRY_NUMBER'} // "") ne "" and ($udev_info->{'_udev_infos'}{'DM_TYPE'} // "") eq "raid")
929 16 50 if (($udev_info->{'_udev_infos'}{'ID_PART_TABLE_TYPE'} // "") eq "")
940 0 357 if ($startline ne "")
944 0 357 unless ($line =~ /;$/)
949 50 307 if ($state == 0) { }
50 257 elsif ($state == 1) { }
257 0 elsif ($state == 2) { }
950 50 0 if ($line eq "BYT;")
955 50 0 if ($line =~ /.*:([0-9]+)B:[^:]*:[0-9]+:[0-9]+:([^:]*):(.*):;/)
963 109 148 if ($line =~ /^1:([0-9]+)B:[0-9]+B:([0-9]+)B:free;$/) { }
148 0 elsif ($line =~ /^([0-9]+):([0-9]+)B:[0-9]+B:([0-9]+)B:[^:]*:(.*):([^:]*);$/) { }
979 0 148 if ($multiline)
981 0 0 if ($label =~ /^Project-Id.*Content-Transfer-Encoding: 8bit$/)
992 0 50 if ($state != 2)
996 7 43 if ($udev_info->{'_udev_infos'}{'ID_PART_TABLE_TYPE'} eq "dos")
1001 2 66 if ($line =~ /^\s([1234]) .* extended( .*)?$/)
1043 96 200 if (scalar @$keys == 1) { }
0 200 elsif (scalar @$keys > 1) { }
1060 105 191 if ($uniq) { }
1061 0 105 if defined $h->{$k}
1137 5 0 if ($line =~ /([^ ]+) (partition|file) ([0-9]+) ([0-9]+)$/) { }
0 0 elsif ($line =~ /([^ ]+) ([^ ]+) ([0-9]+) ([0-9]+)$/) { }
1147 0 5 if ($2 eq "file")
1150 0 0 if defined $mountpoint
1180 0 7 if ($@)
1199 62 210 if (exists $node->{'children'})
1210 62 210 if (exists $node->{'children'})
1244 0 202 unless defined $udev_info
1245 197 5 if (($udev_info->{'_udev_infos'}{'ID_FS_TYPE'} // "") ne "crypto_LUKS")
1276 5 210 if ($line =~ /^LUKS header information/) { }
5 205 elsif ($line =~ /^Version:\s*([^\s]*)$/) { }
1283 5 0 if ($luks_header)
1314 5 36 if $line =~ /^Personalities/
1315 5 31 if $line =~ /^unused devices/
1316 16 15 if $line =~ /^\s/
1337 8 209 if ($line =~ /^\s*Array Size :\s*([0-9]+)\s*\(/) { }
7 202 elsif ($line =~ /^\s*Used Dev Size :\s*([0-9]+)\s*\(/) { }
8 194 elsif ($line =~ /^\s*Raid Level :\s*([^\s].*)/) { }
8 186 elsif ($line =~ /^\s*State : \s*([^\s].*)/) { }
8 178 elsif ($line =~ /^\s*Version : \s*([^\s].*)/) { }
8 170 elsif ($line =~ /^\s*Name : \s*([^\s]+)\s*/) { }
0 170 elsif ($line =~ /^\s*Member Arrays : \s*([^\s]+.*[^\s])\s*/) { }
0 170 elsif ($line =~ /^\s*Container : \s*([^\s]+), member ([0-9]+)\s*/) { }
8 162 elsif ($line =~ /^\s*Number\s*Major\s*Minor\s*RaidDevice(\s*State)?/) { }
1343 0 8 if ($1 eq "container")
1366 23 0 if (not $container and $line =~ /^\s*([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9-]+)\s+([^\s].*[^\s])\s+([^\s]+)$/) { }
0 0 elsif ($container and $line =~ /^\s*(-)\s+([0-9]+)\s+([0-9]+)\s+(-)\s+([^\s]+)$/) { }
0 0 elsif ($line =~ /^\s*$/) { }
1413 8 2 if ($state == 0) { }
2 0 elsif ($state == 1) { }
0 0 elsif ($state == 2) { }
1414 0 8 if $line eq "SAS2IRCU: MPTLib2 Error 1"
1415 7 1 unless $line =~ /^[\s-]*-[\s-]*$/
1418 1 1 if ($line =~ /^SAS2IRCU:/) { }
1 0 elsif ($line =~ /^\s*([0-9]+)\s+/) { }
1419 0 1 if ($line ne "SAS2IRCU: Utility Completed Successfully.")
1432 0 1 if ($state != 2)
1433 0 0 if ($state != 0 or $nodata != 1)
1467 0 0 if ($line eq 'Controller information') { }
0 0 elsif ($line eq 'IR Volume information') { }
0 0 elsif ($line eq 'Physical device information') { }
0 0 elsif ($line eq 'Enclosure information') { }
0 0 elsif ($line =~ /SAS2IRCU:/) { }
1476 0 0 if ($line eq 'SAS2IRCU: Command DISPLAY Completed Successfully.' or $line eq 'SAS2IRCU: Utility Completed Successfully.') { }
1504 14 89 if $line =~ /^[\s-]*$/
1505 2 87 if ($line =~ /^(Controller) information$/ or $line =~ /^(Enclosure) information$/) { }
2 85 elsif ($line =~ /^IR (Volume) information$/ or $line =~ /^Physical (device) information$/) { }
1 84 elsif ($line =~ /^IR volume ([^\s])+$/) { }
4 80 elsif ($line =~ /^Device is a Hard disk$/) { }
1 79 elsif ($line =~ /^Initiator at ID .*$/) { }
2 77 elsif ($line =~ /^SAS2IRCU: .* Completed Successfully.$/) { }
4 73 elsif ($line =~ /^[^\s]/) { }
72 1 elsif ($line =~ /^\s+([^\s][^:]*[^\s])\s*:\s+([^\s].*)$/) { }
1514 0 2 if (exists $l->{$section})
1530 0 2 if (exists $l->{$section})
1556 0 4 if ($state != 0)
1562 2 70 if ($k =~ m(^PHY\[([^\]]+)\] Enclosure#/Slot#)) { }
4 66 elsif ($k eq 'Size (in MB)/(in sectors)') { }
1578 4 62 if ($k eq 'guid') { }
1 61 elsif ($k eq 'wwid') { }
1593 0 21 unless my $dh2 = $self->open_file($line)
1599 1 20 if (defined $wwid->{$addr})
1605 0 1 if (scalar @dirs != 1) { }
1640 2 1 unless $line =~ /^Controller Count:\s*([0-9]+)\.?\s*$/
1664 256 28 if (@$list)
1669 14 0 wantarray ? :
1687 4 22 if $line =~ /^\s*$/
1688 4 18 if ($line =~ /^-- (.*) [Ii]nformation(s)?(\s*--)?\s*$/) { }
4 14 elsif ($line =~ /^--\s*(ID\s*|.*[^\s])\s*$/) { }
14 0 elsif ($line =~ /^(c([0-9]+)(\s|u).*[^\s])\s*$/) { }
0 0 elsif ($line =~ m[^There is at least one disk/array in a NOT OPTIMAL state.$]) { }
0 0 elsif ($line =~ /^RAID ERROR - Arrays: OK:[0-9]+ Bad:[0-9]+ - Disks: OK:[0-9]+ Bad:[0-9]+$/) { }
0 0 elsif ($line =~ /^No MegaRAID or PERC adapter detected on your system!$/) { }
1690 2 2 if ($section_name =~ /Disk/)
1697 0 14 unless exists $megacli->{$idc}
1699 0 14 if (scalar @infos != scalar @headers)
1705 10 4 if ($section_name eq "Disk")
1708 0 14 if (exists $megacli->{$idc}{$section_name}{$id})
1731 0 21 unless (exists $megacli->{$dev}{'Disk'}{$slot_id})
1739 42 445 if $line =~ /^\s*$/
1740 1 444 if $line eq "Adapter #$dev"
1741 0 444 if ($line eq "^Adapter")
1745 10 434 if ($line =~ m[^Enclosure Device ID: *([0-9]+|N/A) *$])
1747 0 10 if $cur_enc eq "N/A"
1751 0 434 if ($line =~ /^Enclosure Device ID: *(.*) *$/)
1754 10 424 if ($line =~ /^Slot Number: *([0-9]+) *$/)
1755 0 10 if (defined $cur_slot or not defined $cur_enc)
1761 1 423 if ($line =~ /^Array *#: *([0-9]+) *$/)
1763 0 1 unless ($d->{'ID'} =~ /^c[0-9]+uXpY$/)
1770 10 414 if ($line =~ /^Coerced Size:.*\[(0x[0-9a-f]+) *Sectors\]/i)
1774 10 414 if ($line =~ /^Sector Size: *([0-9]+)$/i)
1776 10 0 $1 == 0 ? :
1806 6 35 if $line =~ /^\s*$/
1827 14 42 if ($line =~ /running/)
1836 70 106 if $line =~ /^[\s-]*$/
1838 35 71 if ($info[0] // "") eq "Type"
1840 13 58 if $info[3] eq "-"
1841 0 58 if (scalar @info != 4)
1851 19 39 if ($info[0] eq 'file') { }
39 0 elsif ($info[0] eq 'block') { }
1859 14 21 if ($v->{'state'} // 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.
1866 0 14 if ($curdisk ne "" and not $line =~ /^disk\.$curdisk\./)
1867 0 0 if (exists $curdiskinfo->{'name'} and exists $curdiskinfo->{'alias'})
1874 14 0 if $line =~ /^[\s-]*$/
1875 0 0 unless ($line =~ /^([^:\s]+)\s*: (.*)$/)
1880 0 0 if ($key eq "hostname")
1884 0 0 if ($key =~ /^disk\.([0-9]+)\./)
1886 0 0 if ($key =~ /\.(name|alias)$/)
1892 0 14 if ($curdisk ne "")
1931 0 0 if $line =~ /^NAME$/
1955 0 0 if ($filename =~ /(.*) \(deleted\)/)
2009 3 4 if (scalar @files == 0)
2018 0 4 if (scalar @files != scalar @res) { }
2022 9 10 if ($res[$i] =~ /^OK/) { }
2029 4 0 if (scalar @present > 0)