From 4971de39e9c409a0c99d9f42b7ff0fe9737d93df Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 6 Jun 2022 18:31:57 -0700 Subject: [PATCH] Tweak quit_firefox to handle hang on exit on ppc64le (#2094137) It seems when we quit Firefox back to a VT on ppc64le, the system hangs. Not sure why, but we can deal with it by rebooting the system and logging back in as root if it happens. Also take the opportunity to clean up the flow of quit_firefox so we always check that we get back to a console then wait 5 seconds for the console to settle, so all the tests that call it can stop doing that. Signed-off-by: Adam Williamson --- lib/utils.pm | 26 +++++++++++++++++++++----- tests/_iot_zezere_remote.pm | 4 ---- tests/freeipa_password_change.pm | 5 ----- tests/freeipa_webui.pm | 5 ----- tests/realmd_join_cockpit.pm | 5 ----- tests/server_cockpit_autoupdate.pm | 1 - tests/server_cockpit_default.pm | 5 ----- tests/server_cockpit_updates.pm | 5 ----- 8 files changed, 21 insertions(+), 35 deletions(-) diff --git a/lib/utils.pm b/lib/utils.pm index 59e259b6..8eac7b1a 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -946,15 +946,31 @@ sub download_modularity_tests { sub quit_firefox { # Quit Firefox, handling the 'close multiple tabs' warning screen if -# it shows up +# it shows up. Expects to quit to a recognizable console send_key "ctrl-q"; # expect to get to either the tabs warning or a console if (check_screen ["user_console", "root_console", "firefox_close_tabs"], 30) { - # if we hit the tabs warning, click it - click_lastmatch if (match_has_tag "firefox_close_tabs"); + # if we hit a console we're good + unless (match_has_tag("firefox_close_tabs")) { + wait_still_screen 5; + return; + } + # otherwise we hit the tabs warning, click it + click_lastmatch; + # again, if we hit a console, we're good + if (check_screen ["user_console", "root_console"], 30) { + wait_still_screen 5; + return; + } } - # it's a bit odd if we reach here, but could mean we quit to a - # desktop, or the firefox_close_tabs needle went stale... + # if we reach here, we didn't see a console. This is most likely + # https://bugzilla.redhat.com/show_bug.cgi?id=2094137 . soft fail + # and reboot. this won't work if we need to decrypt or handle boot + # args, but I don't think anything that calls this needs it + record_soft_failure "No console on exit from Firefox, probably RHBZ #2094137"; + power "reset"; + boot_to_login_screen; + console_login(user=>"root", password=>get_var("ROOT_PASSWORD")); } sub start_with_launcher { diff --git a/tests/_iot_zezere_remote.pm b/tests/_iot_zezere_remote.pm index 7c32142b..f2a92e8f 100644 --- a/tests/_iot_zezere_remote.pm +++ b/tests/_iot_zezere_remote.pm @@ -44,10 +44,6 @@ sub run { assert_and_click "zezere_provision_schedule"; # exit quit_firefox; - # we don't get back to a prompt instantly and keystrokes while X - # is still shutting down are swallowed, so be careful - assert_screen "root_console"; - wait_still_screen 5; # time before the provision request goes through is kinda hard to # predict, so we'll just try over and over for up to 10 minutes # and bail as soon as it works diff --git a/tests/freeipa_password_change.pm b/tests/freeipa_password_change.pm index 745c321e..d54d5c8b 100644 --- a/tests/freeipa_password_change.pm +++ b/tests/freeipa_password_change.pm @@ -37,11 +37,6 @@ sub run { wait_still_screen 3; # close browser, back to console quit_firefox; - # we don't get back to a prompt instantly and keystrokes while X - # is still shutting down are swallowed, so be careful before - # finishing (and handing off to freeipa_client_postinstall) - assert_screen "root_console"; - wait_still_screen 5; # check we can kinit with changed password assert_script_run 'printf "loremipsum" | kinit test3'; # change password via CLI (back to batterystaple, as that's what diff --git a/tests/freeipa_webui.pm b/tests/freeipa_webui.pm index 232af2e4..1727ef3d 100644 --- a/tests/freeipa_webui.pm +++ b/tests/freeipa_webui.pm @@ -45,11 +45,6 @@ sub run { assert_and_click "freeipa_webui_policy_save"; # quit browser to return to console quit_firefox; - # we don't get back to a prompt instantly and keystrokes while X - # is still shutting down are swallowed, so be careful before - # finishing (and handing off to next test) - assert_screen "root_console"; - wait_still_screen 5; # set permanent passwords for both accounts assert_script_run 'printf "correcthorse\nbatterystaple\nbatterystaple" | kinit test3@TEST.OPENQA.FEDORAPROJECT.ORG'; assert_script_run 'printf "correcthorse\nbatterystaple\nbatterystaple" | kinit test4@TEST.OPENQA.FEDORAPROJECT.ORG'; diff --git a/tests/realmd_join_cockpit.pm b/tests/realmd_join_cockpit.pm index cc931489..b8703a9f 100644 --- a/tests/realmd_join_cockpit.pm +++ b/tests/realmd_join_cockpit.pm @@ -64,11 +64,6 @@ sub run { assert_screen "cockpit_join_complete", 300; # quit browser to return to console quit_firefox; - # we don't get back to a prompt instantly and keystrokes while X - # is still shutting down are swallowed, so be careful before - # finishing (and handing off to next test) - assert_screen "root_console"; - wait_still_screen 5; } sub test_flags { diff --git a/tests/server_cockpit_autoupdate.pm b/tests/server_cockpit_autoupdate.pm index c9a6d2a0..56e15b21 100644 --- a/tests/server_cockpit_autoupdate.pm +++ b/tests/server_cockpit_autoupdate.pm @@ -32,7 +32,6 @@ sub run { # Quit Cockpit quit_firefox; - sleep 3; # Check that the dnf-automatic service has started assert_script_run "systemctl is-active dnf-automatic-install.timer"; diff --git a/tests/server_cockpit_default.pm b/tests/server_cockpit_default.pm index 60fcc023..6a168bc8 100644 --- a/tests/server_cockpit_default.pm +++ b/tests/server_cockpit_default.pm @@ -14,11 +14,6 @@ sub run { start_cockpit(0); # quit firefox (return to console) quit_firefox; - # we don't get back to a prompt instantly and keystrokes while X - # is still shutting down are swallowed, so be careful before - # finishing (and handing off to next test) - assert_screen "root_console"; - wait_still_screen 5; } sub test_flags { diff --git a/tests/server_cockpit_updates.pm b/tests/server_cockpit_updates.pm index 243fe61a..bbc7abe5 100644 --- a/tests/server_cockpit_updates.pm +++ b/tests/server_cockpit_updates.pm @@ -48,7 +48,6 @@ sub run { last if (check_screen("cockpit_updates_updated")); if (check_screen("cockpit_updates_reconnect", 1)) { quit_firefox; - sleep 5; start_cockpit(1); select_cockpit_update(); last; @@ -70,10 +69,6 @@ sub run { # Switch off Cockpit quit_firefox; - # Wait a couple of seconds for the terminal to settle down, the command was - # entered incorrectly which resulted in a failure. - sleep 5; - # Verify that the test package was updated correctly. verify_updated_packages; }