Branch Coverage

blib/lib/Linux/Bootloader/Grub.pm
Criterion Covered Total %
branch 51 150 34.0


line true false branch
146 0 22 unless $self->_check_config
166 65 240 if ($_ =~ /^\s*title\s+(.*)/i)
171 326 2724 if ($_ =~ /$matches{$key}/i)
172 0 326 if exists $sections[$index]{$key}
174 65 261 if ($key eq 'args')
176 22 43 unless $sections[$index]{$key} =~ /\S/
183 0 22 if (not defined $sections[0]{'default'}) { }
0 22 elsif ($sections[0]{'default'} =~ /^saved$/i) { }
188 0 0 unless open DEFAULT_FILE, '/boot/grub/default'
207 0 5 unless defined $newdefault
208 0 5 unless $self->_check_config
214 2 0 unless ($newdefault =~ /^\d+$/ or $newdefault =~ /^saved$/)
216 2 0 unless defined $newdefault
220 3 0 unless ($newdefault =~ /saved/)
221 1 2 if ($newdefault < 0 or $newdefault > $kcount)
229 2 2 if ($config[$index] =~ /(^\s*default\s*\=*\s*)\d+/i) { }
0 2 elsif ($config[$index] =~ /^\s*default\s*\=*\s*saved/i) { }
236 0 0 unless open DEFAULT_FILE, $default_config_file
241 0 0 if ($newdefault eq 'saved')
248 0 0 unless open DEFAULT_FILE, ">$default_config_file"
265 0 6 if $self->debug > 1
267 3 3 if (not defined $param{'add-kernel'} && defined $param{'title'}) { }
0 3 elsif (not -f "$param{'add-kernel'}") { }
1 4 elsif (defined $param{'initrd'} and not -f "$param{'initrd'}") { }
278 0 2 unless $self->_check_config
283 1 1 if (defined $self->_lookup($param{'title'}))
285 0 1 if (defined $param{'force'}) { }
300 1 3 unless (defined $param{$p})
306 1 0 unless ($sections[$default]{'kernel'} =~ m[^/boot])
308 0 1 if defined $param{'initrd'}
312 1 0 if defined $param{'title'}
313 1 0 if defined $param{'boot'}
316 0 1 if (defined $param{'xen'}) { }
318 0 0 if defined $sections[$default]{'root'}
319 0 0 if defined $sections[$default]{'args'}
321 0 0 if defined $sections[$default]{'initrd'}
322 0 0 if defined $param{'add-kernel'}
323 0 0 if defined $param{'root'}
324 0 0 if defined $param{'args'}
326 0 0 if defined $param{'initrd'}
328 1 0 if defined $param{'add-kernel'}
329 1 0 if defined $param{'root'}
330 1 0 if defined $param{'args'}
332 0 1 if defined $param{'initrd'}
335 0 1 if defined $param{'savedefault'}
343 1 0 unless (defined $param{'position'} and $param{'position'} =~ /end|\d+/)
348 0 1 if ($param{'position'} =~ /end/ or $param{'position'} >= $#sections) { }
351 0 0 if ($newconfig[$#newconfig] =~ /\S/)
358 3 16 if ($_ =~ /^\s*title/i)
359 1 2 if ($index == $param{'position'})
370 0 1 if (defined $param{'make-default'} or defined $param{'boot-once'})
383 0 0 if $self->debug > 1
385 0 0 if (defined $params{'option'} and not defined $params{'update-kernel'}) { }
0 0 elsif (not defined $params{'update-kernel'} && (defined $params{'args'} || defined $params{'remove-args'} || defined $params{'option'})) { }
392 0 0 unless $self->_check_config
398 0 0 if (defined $params{'update-kernel'} and not $params{'update-kernel'} =~ /^\d+$/)
403 0 0 if (not $params{'update-kernel'} =~ /^\d+$/ or $params{'update-kernel'} < 0 or $params{'update-kernel'} > $kcount)
409 0 0 if defined $params{'xen'}
416 0 0 if ($line =~ /^\s*title/i)
419 0 0 if ($index == $params{'update-kernel'}) { }
0 0 elsif ($index > $params{'update-kernel'}) { }
420 0 0 if (defined $params{'args'} or defined $params{'remove-args'}) { }
0 0 elsif (defined $params{'option'}) { }
421 0 0 if ($line =~ /$kregex/i)
424 0 0 if defined $params{'remove-args'}
425 0 0 if (defined $params{'args'})
431 0 0 if ($line eq $kernel . $args . "\n") { }
441 0 0 if ($line =~ /^\s*$val.*/i)
454 0 0 if (defined $params{'option'})
491 0 0 if ($line =~ /^\s*$val/)
496 0 0 if ($line =~ /^\s*title/i)
512 0 0 unless ($entry_to_boot_once)
516 0 0 if ($default == $self->_lookup($entry_to_boot_once))
520 0 0 if ($self->_get_bootloader_version < 0.97)
526 0 0 unless (-f '/boot/grub/default')