1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-12-22 10:23:09 +00:00

Be more strict in console_login

Because we use check_screen not assert_screen here, the match
can actually fail, but the match_has_tag conditional can pass
on the *previous* match, if that happened to also be matching
on a console tag. We don't want that. Let's just make these
into assert_screens to avoid it; I don't think there's any path
where we're actually expecting this to work if those
check_screens didn't match.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2019-04-10 10:44:15 -07:00
parent a0a8e3350d
commit e87348abca

View File

@ -157,42 +157,40 @@ sub console_login {
sleep 2;
}
check_screen [$good, 'text_console_login'], $args{timeout};
assert_screen [$good, 'text_console_login'], $args{timeout};
# if we're already logged in, all is good
if (match_has_tag $good) {
_console_login_finish();
return;
}
# if we see the login prompt, type the username
type_string("$args{user}\n") if (match_has_tag 'text_console_login');
check_screen [$good, 'console_password_required'], 30;
# otherwise, we saw the login prompt, type the username
type_string("$args{user}\n");
assert_screen [$good, 'console_password_required'], 30;
# on a live image, just the user name will be enough
if (match_has_tag $good) {
_console_login_finish();
return;
}
# otherwise, type the password if we see the prompt
if (match_has_tag 'console_password_required') {
# otherwise, type the password
type_string "$args{password}";
if (get_var("SWITCHED_LAYOUT") and $args{user} ne "root") {
# see _do_install_and_reboot; when layout is switched
# user password is doubled to contain both US and native
# chars
console_switch_layout;
type_string "$args{password}";
if (get_var("SWITCHED_LAYOUT") and $args{user} ne "root") {
# see _do_install_and_reboot; when layout is switched
# user password is doubled to contain both US and native
# chars
console_switch_layout;
type_string "$args{password}";
console_switch_layout;
}
send_key "ret";
console_switch_layout;
}
send_key "ret";
# make sure we reached the console
unless (check_screen($good, 30)) {
# as of 2018-10 we have a bug in sssd which makes this take
# unusually long in the FreeIPA tests, let's allow longer,
#with a soft fail - RHBZ #1644919
# with a soft fail - RHBZ #1644919
record_soft_failure "Console login is taking a long time - #1644919?";
my $timeout = 30;
# even an extra 30 secs isn't long enough on aarch64...
$timeout= 90 if (get_var("ARCH") eq "aarch64");
$timeout = 90 if (get_var("ARCH") eq "aarch64");
assert_screen($good, $timeout);
}
_console_login_finish();