From 186678e98b7e7f84afb39efa283431541a73f155 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 31 Jan 2017 11:29:59 +0100 Subject: [PATCH] Make log upload work when installed system hits emergency mode Summary: This is to handle cases like #1414904 , where the system boots to emergency mode. We really need logs to try and debug this. Test Plan: Force a test to hit emergency mode somehow (right now you can just run base_services_start on Rawhide over and over until you hit #1414904, but there's probably an easier way to do it, I think there's a systemd boot arg to tell it which target to boot for e.g.) and check logs get uploaded. Also check this doesn't break log upload for a 'normal' failure. Reviewers: garretraziel_but_actually_jsedlak_who_uses_stupid_nicknames Reviewed By: garretraziel_but_actually_jsedlak_who_uses_stupid_nicknames Subscribers: tflink Differential Revision: https://phab.qa.fedoraproject.org/D1103 --- lib/installedtest.pm | 17 ++++++++++++++--- needles/console/emergency_rescue-20170119.json | 16 ++++++++++++++++ needles/console/emergency_rescue-20170119.png | Bin 0 -> 2570 bytes tests/_console_wait_login.pm | 2 +- 4 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 needles/console/emergency_rescue-20170119.json create mode 100644 needles/console/emergency_rescue-20170119.png diff --git a/lib/installedtest.pm b/lib/installedtest.pm index 9fb7fa70..abb43b85 100644 --- a/lib/installedtest.pm +++ b/lib/installedtest.pm @@ -23,10 +23,21 @@ sub root_console { sub post_fail_hook { my $self = shift; - $self->root_console(tty=>6); + if (check_screen 'emergency_rescue', 3) { + my $password = get_var("ROOT_PASSWORD", "weakpassword"); + type_string "$password\n"; + # bring up network so we can upload logs + assert_script_run "dhclient"; + } + else { + $self->root_console(tty=>6); + } - # We can't rely on tar being in minimal installs - assert_script_run "dnf -y install tar", 180; + # We can't rely on tar being in minimal installs, but we also can't + # rely on dnf always working (it fails in emergency mode, not sure + # why), so try it, then check if we have tar + script_run "dnf -y install tar", 180; + assert_script_run "rpm -q tar"; # Note: script_run returns the exit code, so the logic looks weird. # We're testing that the directory exists and contains something. diff --git a/needles/console/emergency_rescue-20170119.json b/needles/console/emergency_rescue-20170119.json new file mode 100644 index 00000000..212ba67e --- /dev/null +++ b/needles/console/emergency_rescue-20170119.json @@ -0,0 +1,16 @@ +{ + "properties": [], + "tags": [ + "LANGUAGE-english", + "emergency_rescue" + ], + "area": [ + { + "xpos": 1, + "ypos": 48, + "width": 142, + "height": 16, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/console/emergency_rescue-20170119.png b/needles/console/emergency_rescue-20170119.png new file mode 100644 index 0000000000000000000000000000000000000000..5ff69e5e298507157d2a0830d2bb781f09ec9c09 GIT binary patch literal 2570 zcmeHI`%}|*7X5q)no8wm2Mfqcz(K%J(rOfHNMr*MP(U70-YgVp3?VE63rI+;IHX$z z*9Rc-a1n|E2_=N2B|w5>!8GMj-XuU$3qs5!h!CSm1DnqN3;Uz@mviUdJLk?l=ZE`k zWH{d3%-#$DU>mG{av$~W|9K<9KA&h~*U+mMl^!iwiLFb+5${o4eC6Cb+sU-gEJhnowVK>cFTHuy zjpeX`sMda#F!0qsn`yn8kD8NMdzItdPNrJbz`3m z$4{aBT+!ZWzhME_^H*D}4QoDPC|*R)Rk#UHG$De_%U?{oxfFndMev*~z5|3zN(QNQ zYXR^RPS8X*RIo}{q^sxy8ik%v z?t~QgHeYF;jPhS)C~k+hz_FDt@+xgR<#|1vfk2}5&wi`LHj)0*e+!Lm{jR;bojz<% z@NeS0;%wDtU+-TMmqMVY0fXz3*MOFfT0Fi0ZEGTv?I14I;(vlfxO6G+a0 zyJ)#w>ONur*ZhIOVsdxT-2eKRH6`O8qzmzj(1kaWw+EmO&uyd-DO!h|w(`rC2z0~Y z!Ql5Rfatwg-;h7@RvbhUkVjtMnVg?cs1YI=t6#?RXFk7Jjgs87z7F{&E5y(daT`)S zSgkK+mcQg0ho2z5Qm5zAepN~I)QoogoDb8786~w&MMKyywsJEs4q|C3d@|{qJGvu_ zCJRQ&S#`IoB`8K=$prGT;JuDOIbSMJnORkQ367K2wLR60emKJecEh2>l#%f)Tc8?) zoV122AkK`P*)2cBT<05cx~>(=Go6X+yv7N#KW zuT#=*xYYab-32N7A1PjoZui>4){#xVPYFe%vGVX4t@;&gCp6nG(K#RU7)W=`M2vOf2$au`SJush+2?T1BD zUZ@I3yBp?tINC|6z*M*$%6fpK?JB(DNmq*qIBpDgBa7y~iIB~riaPjbxAe7FC!L^2 zJ}xH%$M=VEOHyh%OsR*CIwB-OL$F^t^>|>g$a%1)JqBCdb)kSveX2JaH?DTR56g)H zi_o}5>JvL#W%ehAfs68v_LhvrvrV$uy>;&i7if;uh=yHi zv~(u~7)HCP6E2`runGDE0=%Y6!e6L&`=Rr|TrfP@1nX}y#ec+qL;guG2JdDcdF{Z2 z(qZQ4UaOv)#Umopc4Jkhfu#^lTgNvnkBMsrYrK75+MfKQXjEVpS*z6Dpp`j$X2r1x zp%rW5JAW<>*9;ymv*^r!=CQlxXJO8UU{^1NGkP z6?OqD{?{JLZh*V8@1Hl?%9ob4`KZ;}?Ui)E5>U?z?^DXu(>y~jG>#C?(u5W7cBO+$q$2xY6m;x(Qp$A6y-(j(WklZbEw-Vbo1zMB#l3wG`-wL-0BKFKwu`U8Fs9YT#`c1D0m?x+{gv#`#3a%pHMLdwWvVVW%`gu z(s?@R*iNp+c(KJ{)fVU~`Bw=S`7eeiULODe literal 0 HcmV?d00001 diff --git a/tests/_console_wait_login.pm b/tests/_console_wait_login.pm index 8141eaec..c19b9885 100644 --- a/tests/_console_wait_login.pm +++ b/tests/_console_wait_login.pm @@ -1,4 +1,4 @@ -use base "basetest"; +use base "installedtest"; use strict; use testapi; use utils;