Branch Coverage

blib/lib/FusionInventory/Agent/Tools/Linux.pm
Criterion Covered Total %
branch 102 142 71.8


line true false branch
62 0 1 unless $handle
66 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=(.*)/) { }
89 0 1 unless ($result->{'SERIALNUMBER'})
109 1279 96 if ($line =~ /^([^:]+\S) \s* : \s (.+)/x) { }
66 30 elsif ($line =~ /^$/) { }
114 59 7 if $cpu and _isValidCPU($cpu)
121 6 25 if $cpu and _isValidCPU($cpu)
144 1 2903 if ($line =~ m[^udi = '/org/freedesktop/Hal/devices/(storage|legacy_floppy|block)])
149 2871 32 unless defined $device
151 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) { }
186 0 0 unless $file =~ /([shv]d[a-z]|fd\d)$/
190 0 0 getFirstLine('command', '/sbin/fdisk -v') =~ /^GNU/ ? :
199 0 0 unless $handle
202 0 0 unless $line =~ m[^/dev/([shv]d[a-z])]
214 0 0 _getValueFromSysProc($logger, $name, 'removable') ? :
235 0 0 -f "/proc/ide/$device/$key" ? :
0 0 -f "/sys/block/$device/device/$key" ? :
240 0 0 unless $file
243 0 0 unless $handle
259 0 4 $params{'device'} ? :
261 0 4 unless $handle
269 0 39 if ($line =~ /^Vendor: +(\S+)/i)
274 0 39 if ($line =~ /^Product: +(\S+)/i)
279 0 39 if ($line =~ /^Revision: +(\S+)/i)
284 1 38 if ($line =~ /^User Capacity: +(\S.+\S)/i)
289 1 37 if ($line =~ /^Transport protocol: +(\S+)/i)
294 2 35 if ($line =~ /^Device type: +(\S+)/i)
299 2 33 if ($line =~ /^Serial number: +(\S+)/i)
315 0 4 unless $handle
325 18 148 if ($line =~ /^$/)
327 18 0 if $interface
331 20 128 if ($line =~ /^([\w\d.]+)/)
340 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)
349 1 147 if ($line =~ / ether \s ($FusionInventory::Agent::Tools::Linux::mac_address_pattern) .+ \( Ethernet \) /x)
358 16 132 if ($line =~ /inet6 \s (\S+)/x)
362 8 140 if ($line =~ /inet addr:($FusionInventory::Agent::Tools::Linux::ip_address_pattern)/i)
366 8 140 if ($line =~ /Mask:($FusionInventory::Agent::Tools::Linux::ip_address_pattern)/)
370 15 133 if ($line =~ /inet6 addr: (\S+)/i)
374 14 134 if ($line =~ /hwadd?r\s+($FusionInventory::Agent::Tools::Linux::mac_address_pattern)/i)
378 16 132 if ($line =~ /^\s+UP\s/)
382 1 147 if ($line =~ /flags=.*[<,]UP[>,]/)
386 19 129 if ($line =~ /Link encap:(\S+)/)
402 0 0 unless $params{'interface'}
406 0 0 unless socket my $socket, 2, 2, 0
416 0 0 if $retval < 0
427 0 0 if ($datas->{'SPEED'} == 65535)
430 0 0 if $params{'logger'}
443 0 5 unless $handle
448 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) { }
450 11 9 if (@addresses) { }
4 5 elsif ($interface) { }
459 17 3 &any(sub { $_ eq 'UP'; } , split(/,/, $flags, 0)) ? :
504 2 3 if (@addresses) { }
3 0 elsif ($interface) { }