From 9869920f5b4af2e3b1afcdfea2aa5842ea481419 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Sat, 6 Oct 2018 08:44:34 -0700 Subject: [PATCH] Use longer timeout for root console switch after liveinst For some reason, in recent tests, switching to a console after live install completes is taking a long time, and tests are failing because we 'only' allow 10 seconds for the login prompt to appear. This seems to indicate some kind of performance bug, but we don't really want all liveinst tests to fail on in, this is not primarily a performance testing framework. So let's tweak the root_console / console_login bits a bit to allow a configurable timeout for the login prompt to appear, and use that to wait 30 secs instead of 10 in this case. Signed-off-by: Adam Williamson --- lib/anacondatest.pm | 5 ++++- lib/utils.pm | 5 ++++- tests/_do_install_and_reboot.pm | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/anacondatest.pm b/lib/anacondatest.pm index 3a2c2dc1..feb46331 100644 --- a/lib/anacondatest.pm +++ b/lib/anacondatest.pm @@ -61,6 +61,9 @@ sub root_console { # Switch to an appropriate TTY and log in as root. my $self = shift; my %args = ( + # 0 means use console_login's default, non-zero values + # passed to console_login + timeout => 0, @_); # Handle https://bugzilla.redhat.com/show_bug.cgi?id=1635033 if (get_var("LIVE") && get_var("DESKTOP") eq "gnome") { @@ -69,7 +72,7 @@ sub root_console { else { send_key "ctrl-alt-f2"; } - console_login(user=>"root"); + console_login(user=>"root", timeout=>$args{timeout}); } 1; diff --git a/lib/utils.pm b/lib/utils.pm index 4d755443..d88af0d1 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -152,7 +152,10 @@ sub console_login { my %args = ( user => "root", password => get_var("ROOT_PASSWORD", "weakpassword"), + # default is 10 seconds, set below, 0 means 'default' + timeout => 0; @_); + $args{timeout} ||= 10; # There's a timing problem when we switch from a logged-in console # to a non-logged in console and immediately call this function; @@ -179,7 +182,7 @@ sub console_login { sleep 2; } - check_screen [$good, 'text_console_login'], 10; + check_screen [$good, 'text_console_login'], $args{timeout}; # if we're already logged in, all is good if (match_has_tag $good) { _console_login_finish(); diff --git a/tests/_do_install_and_reboot.pm b/tests/_do_install_and_reboot.pm index 825788c2..827bc110 100644 --- a/tests/_do_install_and_reboot.pm +++ b/tests/_do_install_and_reboot.pm @@ -117,8 +117,9 @@ sub run { assert_and_click "anaconda_install_done"; if (get_var('LIVE')) { # reboot from a console, it's more reliable than the desktop - # runners - $self->root_console; + # runners. As of 2018-10 switching to console after liveinst + # seems to take a long time, so use a longer timeout here + $self->root_console(timeout=>30); # if we didn't set a root password during install, set it # now...this is kinda icky, but I don't see a great option if (get_var("INSTALLER_NO_ROOT")) {