Branch Coverage

blib/lib/FusionInventory/Agent/Tools/Linux.pm
Criterion Covered Total %
branch 102 132 77.2


line true false branch
55 0 1 unless $handle
59 1 48 if ($line =~ /^S:.*-scsi-(\d+):(\d+):(\d+):(\d+)/) { }
0 48 elsif ($line =~ /^E:ID_VENDOR=(.*)/) { }
1 47 elsif ($line =~ /^E:ID_MODEL=(.*)/) { }
1 46 elsif ($line =~ /^E:ID_REVISION=(.*)/) { }
1 45 elsif ($line =~ /^E:ID_SERIAL=(.*)/) { }
1 44 elsif ($line =~ /^E:ID_SERIAL_SHORT=(.*)/) { }
1 43 elsif ($line =~ /^E:ID_TYPE=(.*)/) { }
1 42 elsif ($line =~ /^E:ID_BUS=(.*)/) { }
82 0 1 unless ($result->{'SERIALNUMBER'})
102 1279 96 if ($line =~ /^([^:]+\S) \s* : \s (.+)/x) { }
66 30 elsif ($line =~ /^$/) { }
107 59 7 if $cpu and _isValidCPU($cpu)
114 6 25 if $cpu and _isValidCPU($cpu)
137 1 2903 if ($line =~ m[^udi = '/org/freedesktop/Hal/devices/(storage|legacy_floppy|block)])
142 2871 32 unless defined $device
144 1 31 if ($line =~ /^$/) { }
1 30 elsif ($line =~ /^\s+ storage.serial \s = \s '([^']+)'/x) { }
1 29 elsif ($line =~ /^\s+ storage.firmware_version \s = \s '([^']+)'/x) { }
1 28 elsif ($line =~ /^\s+ block.device \s = \s '([^']+)'/x) { }
1 27 elsif ($line =~ /^\s+ info.vendor \s = \s '([^']+)'/x) { }
1 26 elsif ($line =~ /^\s+ storage.model \s = \s '([^']+)'/x) { }
1 25 elsif ($line =~ /^\s+ storage.drive_type \s = \s '([^']+)'/x) { }
1 24 elsif ($line =~ /^\s+ storage.size \s = \s (\S+)/x) { }
179 0 0 unless $file =~ /([shv]d[a-z]|fd\d)$/
183 0 0 getFirstLine('command', '/sbin/fdisk -v') =~ /^GNU/ ? :
192 0 0 unless $handle
195 0 0 unless $line =~ m[^/dev/([shv]d[a-z])]
207 0 0 _getValueFromSysProc($logger, $name, 'removable') ? :
228 0 0 -f "/proc/ide/$device/$key" ? :
0 0 -f "/sys/block/$device/device/$key" ? :
233 0 0 unless $file
236 0 0 unless $handle
252 0 4 $params{'device'} ? :
254 0 4 unless $handle
262 0 39 if ($line =~ /^Vendor: +(\S+)/i)
267 0 39 if ($line =~ /^Product: +(\S+)/i)
272 0 39 if ($line =~ /^Revision: +(\S+)/i)
277 1 38 if ($line =~ /^User Capacity: +(\S.+\S)/i)
282 1 37 if ($line =~ /^Transport protocol: +(\S+)/i)
287 2 35 if ($line =~ /^Device type: +(\S+)/i)
292 2 33 if ($line =~ /^Serial number: +(\S+)/i)
308 0 4 unless $handle
318 18 148 if ($line =~ /^$/)
320 18 0 if $interface
324 20 128 if ($line =~ /^([\w\d.]+)/)
333 1 147 if ($line =~ / inet \s ($FusionInventory::Agent::Tools::Linux::ip_address_pattern) \s+ netmask \s ($FusionInventory::Agent::Tools::Linux::ip_address_pattern) \s+ broadcast \s $FusionInventory::Agent::Tools::Linux::ip_address_pattern /x)
342 1 147 if ($line =~ / ether \s ($FusionInventory::Agent::Tools::Linux::mac_address_pattern) .+ \( Ethernet \) /x)
351 16 132 if ($line =~ /inet6 \s (\S+)/x)
355 8 140 if ($line =~ /inet addr:($FusionInventory::Agent::Tools::Linux::ip_address_pattern)/i)
359 8 140 if ($line =~ /Mask:($FusionInventory::Agent::Tools::Linux::ip_address_pattern)/)
363 15 133 if ($line =~ /inet6 addr: (\S+)/i)
367 14 134 if ($line =~ /hwadd?r\s+($FusionInventory::Agent::Tools::Linux::mac_address_pattern)/i)
371 16 132 if ($line =~ /^\s+UP\s/)
375 1 147 if ($line =~ /flags=.*[<,]UP[>,]/)
379 19 129 if ($line =~ /Link encap:(\S+)/)
395 0 5 unless $handle
400 20 59 if ($line =~ /^\d+:\s+(\S+): <([^>]+)>/) { }
20 39 elsif ($line =~ m[link/\S+ ($FusionInventory::Agent::Tools::Linux::any_mac_address_pattern)?]) { }
10 29 elsif ($line =~ m[inet6 (\S+)/(\d{1,2})]) { }
15 14 elsif ($line =~ m[ inet \s ($FusionInventory::Agent::Tools::Linux::ip_address_pattern)(?:/(\d{1,3}))? \s .* \s (\S+)$ ]x) { }
402 11 9 if (@addresses) { }
4 5 elsif ($interface) { }
411 17 3 &any(sub { $_ eq 'UP'; } , split(/,/, $flags, 0)) ? :
456 2 3 if (@addresses) { }
3 0 elsif ($interface) { }