From 9b91c839a78c57bb085da6a8e8b910b5181b7c81 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 31 Aug 2017 14:39:07 -0400 Subject: [PATCH] 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. --- lib/utils.pm | 15 +++++++++++++-- ...r_logged_in-noprofile-bash44-20170831.json | 18 ++++++++++++++++++ ...er_logged_in-noprofile-bash44-20170831.png | Bin 0 -> 1493 bytes 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 needles/console/user_logged_in-noprofile-bash44-20170831.json create mode 100644 needles/console/user_logged_in-noprofile-bash44-20170831.png diff --git a/lib/utils.pm b/lib/utils.pm index e5d82fe4..6a8f06b9 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -98,6 +98,16 @@ sub desktop_switch_layout { 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 # it requires TTY to be already displayed (handled by the root_console() # method of distribution classes) @@ -134,12 +144,12 @@ sub console_login { check_screen [$good, 'text_console_login'], 10; # 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 type_string("$args{user}\n") if (match_has_tag 'text_console_login'); check_screen [$good, 'console_password_required'], 30; # 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 if (match_has_tag 'console_password_required') { type_string "$args{password}"; @@ -155,6 +165,7 @@ sub console_login { } # make sure we reached the console assert_screen($good, 30); + _console_login_finish(); } # load US layout (from a root console) diff --git a/needles/console/user_logged_in-noprofile-bash44-20170831.json b/needles/console/user_logged_in-noprofile-bash44-20170831.json new file mode 100644 index 00000000..97876ea7 --- /dev/null +++ b/needles/console/user_logged_in-noprofile-bash44-20170831.json @@ -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" + ] +} diff --git a/needles/console/user_logged_in-noprofile-bash44-20170831.png b/needles/console/user_logged_in-noprofile-bash44-20170831.png new file mode 100644 index 0000000000000000000000000000000000000000..49d08c9f24f4a4aa65074f090bf643dc250edebe GIT binary patch literal 1493 zcmchX`!^E`0LM2g%33>0oJ+WOZ~@p1V-ScwkYxWHOnDucXWa0DH-H{hOwWj*t1o{#SvH zC`T32skBpR_a3I*y%)0@X=y?tY&P2TbYB_`!K>doh$E{zcssnMq`<5KWcY}Y2kq(qm0C&x|^ zRiWN1NXX%fddlp7@Y{U43|?O{EIPT?aQi+NSrL{^+_d63w_O-| z;_U&P3%!SOX!7E2= zVLHM41p1{yEY3#nj(gXVjZ(STT%S{qxs(-=cjliWYG(ZgsVgxU3Jr;l(^}lZkluGh zN&}-*-hJ)9-dwAb9G^s>jrXwzeWo37wap{ri5*KI=a$Xdk(Jf8iJ_D~6&-%}i+9>5 z_1eiw0Km_k=K(^-1c7#z*xHuI=#wfHPc2qK55X@wnzgP{uGYwd=$m$~ELx(XS<&;| zHJ+3QrzZ2p?8i-KieaA#dOH?WXJba=b#LQ8xD9Lu7Prx?FdWl1aNS5&truNxNRT7T zFjZ(yW@f?=AZZPrlKYZ<06mC%BgsG(dWX-BeAd(K=8xB`_e)1Db#rW5>NtjHjD>W; zMccS#Y1|3THABwZ;ZYp8#aD98E&^w5w%wZgjpf6wR?`@;p4M^`KK^c!r^6+U*%=Bp ztf^47cLP>Bjy+$H1lyyA0xMln;lXGEWZI2pdp@1l4P3y)2r z%0>|=0y-$mKav^rEB;u_{+Vuxaj9Q_^AH|2STmBa$u=6Q3B--KBS@OLaNuUtlN9|= zv10W>55zQ`tqxA3vpH~{5iK?J>Er;e@S_-!JwuPvr*LcHXWJE;O0wD0!AvL=!A5|= zU{1ZdF}*yn>SoqH4jpC!OG9Oap8DuAEwIhYg?Nd;M~7uCcxUTZ_L#%tLWAYpj$?kxYm bwh23Xwzb)NU4n@!Je}&!1>gM-EXc1% literal 0 HcmV?d00001