os-autoinst-distri-rocky/tests/_advisory_update.pm
Adam Williamson 0bf76db7d5 Add a test of bootchain stuff for updates
This adds a new test intended to just check boot chain things
for updates. It doesn't run any test modules besides the stock
update ones, but sets a variable, ADVISORY_BOOT_TEST, which
causes _advisory_update to do some additional stuff after
installing the updates but before rebooting: it forces regen
of the initramfs and bootloader config, and reinstalls the
bootloader on BIOS (not UEFI as it's not relevant). If the
following boot fails, we probably have a bug somewhere.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-10-04 16:43:15 -07:00

33 lines
1014 B
Perl

use base "installedtest";
use strict;
use testapi;
use utils;
sub run {
my $self = shift;
# do the 'repo setup' steps, which set up a repo containing the
# update packages and run 'dnf update'
$self->root_console(tty=>3);
repo_setup;
if (get_var("ADVISORY_BOOT_TEST")) {
# to test boot stuff - in case the update touched grub2, or dracut,
# or anything adjacent - let's force-regenerate the initramfs and
# the bootloader config, and reinstall the bootloader on BIOS. This
# is kinda arch-dependent, but works for the three arches currently
# in openQA: x86_64, ppc64le, and aarch64.
assert_script_run "dracut -f";
assert_script_run 'grub2-mkconfig -o $(readlink -m /etc/grub2.cfg)';
assert_script_run "grub2-install /dev/vda" unless (get_var("UEFI"));
}
# reboot, in case any of the updates need a reboot to apply
script_run "reboot", 0;
}
sub test_flags {
return { fatal => 1 };
}
1;
# vim: set sw=4 et: