Treat failure to source bash profile as a soft fail

There's a bug in current Rawhide causing sourcing of /etc/bashrc
to fail when logging in as a regular user. This results in the
bash prompt looking different, which is currently a hard fail,
and causes most tests to die. It's better to treat this as a
soft fail so the rest of the test can run. So add a needle to
spot this case, and a little finish function the console login
function calls whenever it's successfully logged in, to check
whether it got the no-profile prompt and register a soft fail.
This commit is contained in:
Adam Williamson 2017-08-31 14:39:07 -04:00
parent f63ee5389a
commit 9b91c839a7
3 changed files with 31 additions and 2 deletions

View File

@ -98,6 +98,16 @@ sub desktop_switch_layout {
assert_screen "${environment}_layout_${layout}", 3; assert_screen "${environment}_layout_${layout}", 3;
} }
# this is used at the end of console_login to check if we got a prompt
# indicating that we got a bash shell, but sourcing of /etc/bashrc
# failed (the prompt looks different in this case). We treat this as
# a soft failure.
sub _console_login_finish {
if (match_has_tag "bash_noprofile") {
record_soft_failure "It looks like profile sourcing failed";
}
}
# this subroutine handles logging in as a root/specified user into console # this subroutine handles logging in as a root/specified user into console
# it requires TTY to be already displayed (handled by the root_console() # it requires TTY to be already displayed (handled by the root_console()
# method of distribution classes) # method of distribution classes)
@ -134,12 +144,12 @@ sub console_login {
check_screen [$good, 'text_console_login'], 10; check_screen [$good, 'text_console_login'], 10;
# if we're already logged in, all is good # if we're already logged in, all is good
return if (match_has_tag $good); _console_login_finish() if (match_has_tag $good);
# if we see the login prompt, type the username # if we see the login prompt, type the username
type_string("$args{user}\n") if (match_has_tag 'text_console_login'); type_string("$args{user}\n") if (match_has_tag 'text_console_login');
check_screen [$good, 'console_password_required'], 30; check_screen [$good, 'console_password_required'], 30;
# on a live image, just the user name will be enough # on a live image, just the user name will be enough
return if (match_has_tag $good); _console_login_finish() if (match_has_tag $good);
# otherwise, type the password if we see the prompt # otherwise, type the password if we see the prompt
if (match_has_tag 'console_password_required') { if (match_has_tag 'console_password_required') {
type_string "$args{password}"; type_string "$args{password}";
@ -155,6 +165,7 @@ sub console_login {
} }
# make sure we reached the console # make sure we reached the console
assert_screen($good, 30); assert_screen($good, 30);
_console_login_finish();
} }
# load US layout (from a root console) # load US layout (from a root console)

View File

@ -0,0 +1,18 @@
{
"area": [
{
"type": "match",
"ypos": 127,
"xpos": 1,
"height": 16,
"width": 80
}
],
"properties": [],
"tags": [
"ENV-DISTRI-fedora",
"bash_noprofile",
"user_console",
"user_logged_in"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB