1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-29 09:03:08 +00:00

Simplify and improve how we get to 'linux' line in grub

That whole creaky edifice of conditionals that figured out how
many times to press 'down' was a mess I always hated, and I just
found out that the fix for BLS wasn't complete - I'd assumed in
writing it that systems weren't being migrated to BLS on upgrade
to F30, but actually they are. This makes that design very hard
as we'd have had to find a way to change the number of 'down'
presses part-way through update tests, and all the ways I can
think of to do that would've made this even sillier.

Happily I managed to come up with what looks like a much simpler
approach: just go from the bottom. It seems that in every setup
I can think of to check - all three arches, BLS, no BLS, pre-
install, post-install - the linux line is two lines up from the
bottom of the config stanza (the last line is blank, and the
last line but one is the initramfs line). So we can just press
down 50 times (to make damn sure we're at the bottom) then press
up twice and we should be in the right place, no matter the arch,
the release, or if BLS is in use or not. Whew.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2018-11-30 14:17:01 -08:00
parent 0d54e222f7
commit 56060ff8bd

View File

@ -278,44 +278,21 @@ sub do_bootloader {
} }
else { else {
send_key "e"; send_key "e";
# 2 'downs' to reach the kernel line for UEFI installer, # we need to get to the 'linux' line here, and grub does
# 13 'downs' on installed x86_64. 12 'downs' on installed # not have any easy way to do that. Depending on the arch
# ppc64, because it doesn't have a 'set gfxpayload=keep' # and the Fedora release, we may have to press 'down' 2
# line. installed aarch64 is tricky: it should be 13, I # times, or 13, or 12, or some other goddamn number. That
# think - it has a set gfxpayload=keep line - but it seems # got painful to keep track of, so let's go bottom-up:
# that on F27 installs (i.e. support_server) there is a # press 'down' 50 times to make sure we're at the bottom,
# 'set root' line, but on F28+ installs there is not, so # then 'up' twice to reach the 'linux' line. This seems to
# the count is 12. So we have to do something gross. # work in every permutation I can think of to test.
my $presses = 2; for (1 .. 50) {
if ($args{postinstall}) { send_key 'down';
# we need to decide if BLS is in effect...this is fun
my $version = get_var("VERSION");
# support_server uses a disk image of version CURRREL
$version = get_var("CURRREL") if (get_var('TEST') eq 'support_server');
# use RAWREL to get a numeric version for Rawhide tests
$version = get_var("RAWREL") if ($version eq 'Rawhide');
# for upgrade tests, assume 'effective' version is the
# starting version; if BLS migration is applied during
# upgrade this will get REALLY tricky as we'll need to
# switch halfway through...
$version = get_var("CURRREL") if (get_var("TEST") =~ m/^upgrade_/);
$version = get_var("PREVREL") if (get_var("TEST") =~ m/^upgrade_2/);
if ($version > 29) {
# this means 'BLS is active'; it seems that we always
# need 3 presses on all arches with BLS
$presses = 3;
}
elsif (get_var('OFW') || (get_var('ARCH') eq 'aarch64' && get_var('TEST') ne 'support_server')) {
$presses = 12;
}
else {
$presses = 13;
}
}
foreach my $i (1..$presses) {
sleep 1; # seems to have missed one down if too fast.
send_key "down";
} }
sleep 1;
send_key 'up';
sleep 1;
send_key 'up';
send_key "end"; send_key "end";
} }
# Change type_string by type_safely because keyboard polling # Change type_string by type_safely because keyboard polling