From 520a45b7b28fcb923f51a31edd3d54763fd99f1e Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 8 Dec 2015 08:08:15 -0800 Subject: [PATCH] console_login: sleep a bit before starting Summary: This is a bit icky, but it's the easiest way to solve a problem I've seen a few times, the latest case being https://openqa.stg.fedoraproject.org/tests/1664 . In that test, _console_wait_login logs in to tty1 as user, then uefi_ postinstall wants to switch to tty3 and log in as root. When it does that, sometimes the check_screen loop in console_login gets hit before the display has actually switched from tty1 to tty3, so everything gets out of sync. An alternative would be to have root_console check that it's either logged in or at the correct tty before handing off to console_login, but that starts duplicating stuff, and it breaks in the case the target tty is logged in as a user and the login prompt is no longer visible... Test Plan: Check all tests run as normal, and maybe run UEFI tests a few times to see that the bug no longer happens (but it's hard to reliably trigger it anyway). Reviewers: garretraziel, jskladan Reviewed By: jskladan Subscribers: tflink Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D683 --- lib/fedorabase.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/fedorabase.pm b/lib/fedorabase.pm index 422ed9e2..352a5cd2 100644 --- a/lib/fedorabase.pm +++ b/lib/fedorabase.pm @@ -17,6 +17,14 @@ sub console_login { check => 1, @_); + # There's a timing problem when we switch from a logged-in console + # to a non-logged in console and immediately call this function; + # if the switch lags a bit, this function will match one of the + # logged-in needles for the console we switched from, and get out + # of sync (e.g. https://openqa.stg.fedoraproject.org/tests/1664 ) + # To avoid this, we'll sleep a couple of seconds before starting + sleep 2; + my $good = ""; my $bad = ""; my $needuser = 1;