diff --git a/lib/fedorabase.pm b/lib/fedorabase.pm index 8b34b560..49d97692 100644 --- a/lib/fedorabase.pm +++ b/lib/fedorabase.pm @@ -149,19 +149,6 @@ sub do_bootloader { send_key "ret"; } -sub boot_to_login_screen { - my $self = shift; - my $boot_done_screen = shift; # what to expect when system is booted (e. g. GDM), can be "" - my $stillscreen = shift || 10; - my $timeout = shift || 60; - - wait_still_screen $stillscreen, $timeout; - - if ($boot_done_screen ne "") { - assert_screen $boot_done_screen; - } -} - sub get_milestone { my $self = shift; # FIXME: we don't know how to do this with Pungi 4 yet. diff --git a/lib/main_common.pm b/lib/main_common.pm index 4c97ea9f..9b3cd4fb 100644 --- a/lib/main_common.pm +++ b/lib/main_common.pm @@ -6,7 +6,7 @@ use base 'Exporter'; use Exporter; use testapi; -our @EXPORT = qw/run_with_error_check check_type_string type_safely type_very_safely desktop_vt/; +our @EXPORT = qw/run_with_error_check check_type_string type_safely type_very_safely desktop_vt boot_to_login_screen/; sub run_with_error_check { my ($func, $error_screen) = @_; @@ -62,3 +62,25 @@ sub desktop_vt { } send_key "ctrl-alt-f${tty}"; } + +# Wait for login screen to appear. Handle the annoying GPU buffer +# problem where we see a stale copy of the login screen from the +# previous boot. Will suffer a ~30 second delay if there's a chance +# we're *already at* the expected login screen. +sub boot_to_login_screen { + my %args = @_; + $args{timeout} //= 300; + # we may start at a screen that matches one of the needles; if so, + # wait till we don't (e.g. when rebooting at end of live install, + # we match text_console_login until the console disappears) + my $count = 5; + while (check_screen("login_screen", 3) && $count > 0) { + sleep 5; + $count -= 1; + } + assert_screen "login_screen", $args{timeout}; + if (match_has_tag "graphical_login") { + wait_still_screen 10, 30; + assert_screen "login_screen"; + } +} diff --git a/main.pm b/main.pm index 5219119d..2bfcb0ca 100644 --- a/main.pm +++ b/main.pm @@ -103,7 +103,7 @@ sub load_upgrade_tests() { autotest::loadtest "tests/upgrade_preinstall.pm"; autotest::loadtest "tests/upgrade_run.pm"; # set postinstall test - set_var('POSTINSTALL', "upgrade" ); + set_var('POSTINSTALL', "upgrade_postinstall" ); } sub load_install_tests() { @@ -208,7 +208,7 @@ sub load_postinstall_tests() { if (get_var("POSTINSTALL")) { my @pis = split(/ /, get_var("POSTINSTALL")); foreach my $pi (@pis) { - autotest::loadtest "tests/${pi}_postinstall.pm"; + autotest::loadtest "tests/${pi}.pm"; } } @@ -233,9 +233,9 @@ if (get_var("ENTRYPOINT")) { elsif (get_var("UPGRADE")) { load_upgrade_tests; } -elsif (!get_var("BOOTFROM")) { - # for now we can assume BOOTFROM means this test picks up - # after an install, so we skip to post-install +elsif (!get_var("START_AFTER_TEST") && !get_var("BOOTFROM")) { + # for now we can assume START_AFTER_TEST and BOOTFROM mean the + # test picks up after an install, so we skip to post-install load_install_tests; } diff --git a/needles/console/text_console_login.json b/needles/console/text_console_login.json index 928208df..8510f26d 100644 --- a/needles/console/text_console_login.json +++ b/needles/console/text_console_login.json @@ -11,7 +11,8 @@ "properties": [], "tags": [ "text_console_login", + "login_screen", "ENV-DISTRI-fedora", "ENV-FLAVOR-develop" ] -} \ No newline at end of file +} diff --git a/needles/gnome/login_gdm.json b/needles/gnome/login_gdm.json index acdad306..a206859f 100644 --- a/needles/gnome/login_gdm.json +++ b/needles/gnome/login_gdm.json @@ -1,6 +1,7 @@ { "tags": [ "graphical_login", + "login_screen", "DESKTOP-gnome", "ENV-DISTRI-fedora", "LANGUAGE-english", diff --git a/needles/kde/login_sddm-20160518.json b/needles/kde/login_sddm-20160518.json index 447ce4da..5c3c165a 100644 --- a/needles/kde/login_sddm-20160518.json +++ b/needles/kde/login_sddm-20160518.json @@ -18,8 +18,9 @@ ], "tags": [ "graphical_login", + "login_screen", "DESKTOP-kde", "LANGUAGE-english", "ENV-FLAVOR-kde_live" ] -} \ No newline at end of file +} diff --git a/needles/kde/login_sddm-20160628.json b/needles/kde/login_sddm-20160628.json deleted file mode 100644 index 115b45ba..00000000 --- a/needles/kde/login_sddm-20160628.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "tags": [ - "graphical_login", - "DESKTOP-kde", - "LANGUAGE-english" - ], - "area": [ - { - "xpos": 455, - "ypos": 298, - "width": 115, - "height": 113, - "type": "match" - }, - { - "xpos": 7, - "ypos": 743, - "width": 48, - "height": 16, - "type": "match" - } - ], - "properties": [] -} \ No newline at end of file diff --git a/needles/kde/login_sddm-20160628.png b/needles/kde/login_sddm-20160628.png deleted file mode 100644 index c36ac0f5..00000000 Binary files a/needles/kde/login_sddm-20160628.png and /dev/null differ diff --git a/needles/kde/login_sddm-20160701_f24updated.json b/needles/kde/login_sddm-20160701_f24updated.json deleted file mode 100644 index c2b5e068..00000000 --- a/needles/kde/login_sddm-20160701_f24updated.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "area": [ - { - "width": 54, - "xpos": 17, - "ypos": 444, - "type": "match", - "height": 18 - }, - { - "width": 47, - "type": "match", - "height": 19, - "ypos": 444, - "xpos": 542 - } - ], - "properties": [], - "tags": [ - "DESKTOP-kde", - "LANGUAGE-english", - "graphical_login" - ] -} \ No newline at end of file diff --git a/needles/kde/login_sddm-20160701_f24updated.png b/needles/kde/login_sddm-20160701_f24updated.png deleted file mode 100644 index 60a678ad..00000000 Binary files a/needles/kde/login_sddm-20160701_f24updated.png and /dev/null differ diff --git a/needles/kde/login_sddm-20160830.json b/needles/kde/login_sddm-20160830.json index 5166a3fe..4feef1dd 100644 --- a/needles/kde/login_sddm-20160830.json +++ b/needles/kde/login_sddm-20160830.json @@ -18,8 +18,9 @@ ], "tags": [ "graphical_login", + "login_screen", "DESKTOP-kde", "LANGUAGE-english", "ENV-FLAVOR-kde_live" ] -} \ No newline at end of file +} diff --git a/needles/kde/login_sddm.json b/needles/kde/login_sddm.json index 922baf5f..9cae2415 100644 --- a/needles/kde/login_sddm.json +++ b/needles/kde/login_sddm.json @@ -1,12 +1,13 @@ { - "tags": [ + "tags": [ "graphical_login", + "login_screen", "DESKTOP-kde", "LANGUAGE-english", "ENV-FLAVOR-kde_live" ], "properties": [], - "area": [ + "area": [ { "xpos": 18, "ypos": 444, diff --git a/templates b/templates index 5a57ca83..9d065082 100755 --- a/templates +++ b/templates @@ -1962,7 +1962,9 @@ { name => "base_selinux", settings => [ - { key => "ENTRYPOINT", value => "base_selinux" }, + { key => "POSTINSTALL", value => "base_selinux" }, + { key => "USER_LOGIN", value => "false" }, + { key => "ROOT_PASSWORD", value => "weakpassword" }, { key => "START_AFTER_TEST", value => "install_default_upload" }, { key => "BOOTFROM", value => "c" }, { key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" }, @@ -1971,7 +1973,9 @@ { name => "base_services_start", settings => [ - { key => "ENTRYPOINT", value => "base_services_start" }, + { key => "POSTINSTALL", value => "base_services_start" }, + { key => "USER_LOGIN", value => "false" }, + { key => "ROOT_PASSWORD", value => "weakpassword" }, { key => "START_AFTER_TEST", value => "install_default_upload" }, { key => "BOOTFROM", value => "c" }, { key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" }, @@ -1980,7 +1984,9 @@ { name => "base_services_start_arm", settings => [ - { key => "ENTRYPOINT", value => "base_services_start" }, + { key => "POSTINSTALL", value => "base_services_start" }, + { key => "USER_LOGIN", value => "false" }, + { key => "ROOT_PASSWORD", value => "weakpassword" }, { key => "START_AFTER_TEST", value => "install_arm_image_deployment_upload" }, { key => "NUMDISKS", value => "1" }, { key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" }, @@ -1989,7 +1995,9 @@ { name => "base_service_manipulation", settings => [ - { key => "ENTRYPOINT", value => "base_service_manipulation" }, + { key => "POSTINSTALL", value => "base_service_manipulation" }, + { key => "USER_LOGIN", value => "false" }, + { key => "ROOT_PASSWORD", value => "weakpassword" }, { key => "START_AFTER_TEST", value => "install_default_upload" }, { key => "BOOTFROM", value => "c" }, { key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" }, @@ -1998,7 +2006,9 @@ { name => "base_update_cli", settings => [ - { key => "ENTRYPOINT", value => "base_update_cli" }, + { key => "POSTINSTALL", value => "base_update_cli" }, + { key => "USER_LOGIN", value => "false" }, + { key => "ROOT_PASSWORD", value => "weakpassword" }, { key => "START_AFTER_TEST", value => "install_default_upload" }, { key => "BOOTFROM", value => "c" }, { key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" }, @@ -2037,7 +2047,10 @@ { name => "server_role_deploy_domain_controller", settings => [ - { key => "ENTRYPOINT", value => "role_deploy_domain_controller" }, + { key => "POSTINSTALL", value => "role_deploy_domain_controller" }, + { key => "USER_LOGIN", value => "false" }, + { key => "ROOT_PASSWORD", value => "weakpassword" }, + { key => "GRUB_POSTINSTALL", value => "net.ifnames=0 biosdevname=0" }, { key => "START_AFTER_TEST", value => "install_default_upload" }, { key => "BOOTFROM", value => "c" }, { key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" }, @@ -2183,7 +2196,7 @@ { name => "desktop_notifications_live", settings => [ - { key => "ENTRYPOINT", value => "desktop_notifications_postinstall" }, + { key => "ENTRYPOINT", value => "desktop_notifications" }, ], }, { diff --git a/tests/_console_wait_login.pm b/tests/_console_wait_login.pm index 1c20b668..ea068a0b 100644 --- a/tests/_console_wait_login.pm +++ b/tests/_console_wait_login.pm @@ -1,6 +1,7 @@ use base "fedorabase"; use strict; use testapi; +use main_common; sub run { my $self = shift; @@ -15,7 +16,7 @@ sub run { } # Wait for the text login - assert_screen "text_console_login", $wait_time; + boot_to_login_screen(timeout => $wait_time); # do user login unless USER_LOGIN is set to string 'false' unless (get_var("USER_LOGIN") eq "false") { diff --git a/tests/_graphical_wait_login.pm b/tests/_graphical_wait_login.pm index 25af63bb..e713b100 100644 --- a/tests/_graphical_wait_login.pm +++ b/tests/_graphical_wait_login.pm @@ -14,11 +14,7 @@ sub run { $wait_time = 6000 if (get_var("UPGRADE") && !get_var("ENCRYPT_PASSWORD")); # Wait for the login screen - assert_screen "graphical_login", $wait_time; - # handle the qemu display buffer sometimes showing the DM from the - # *previous* boot - https://openqa.stg.fedoraproject.org/tests/17116 - wait_still_screen; - assert_screen "graphical_login"; + boot_to_login_screen(timeout => $wait_time); # do user login unless USER_LOGIN is set to string 'false' unless (get_var("USER_LOGIN") eq "false") { if (get_var("DESKTOP") eq 'gnome') { diff --git a/tests/_support_server_postinstall.pm b/tests/_support_server.pm similarity index 100% rename from tests/_support_server_postinstall.pm rename to tests/_support_server.pm diff --git a/tests/base_selinux.pm b/tests/base_selinux.pm index ef01a100..ef5938cb 100644 --- a/tests/base_selinux.pm +++ b/tests/base_selinux.pm @@ -4,8 +4,6 @@ use testapi; sub run { my $self=shift; - # wait for boot to complete - $self->boot_to_login_screen("", 30); # switch to TTY3 for both, graphical and console tests $self->root_console(tty=>3); validate_script_output 'getenforce', sub { $_ =~ m/Enforcing/ }; diff --git a/tests/base_service_manipulation.pm b/tests/base_service_manipulation.pm index 60850e9a..51771267 100644 --- a/tests/base_service_manipulation.pm +++ b/tests/base_service_manipulation.pm @@ -1,11 +1,10 @@ use base "installedtest"; use strict; use testapi; +use main_common; sub run { - my $self=shift; - # wait for boot to complete - $self->boot_to_login_screen("", 30); + my $self = shift; # switch to TTY3 for both, graphical and console tests $self->root_console(tty=>3); # we could make this slightly more 'efficient' by assuming sshd @@ -14,7 +13,7 @@ sub run { script_run "systemctl stop sshd.service"; script_run "systemctl disable sshd.service"; script_run "reboot"; - $self->boot_to_login_screen("", 30); + boot_to_login_screen; $self->root_console(tty=>3); # note the use of ! here is a bash-ism, but it sure makes life easier assert_script_run '! systemctl is-enabled sshd.service'; @@ -33,14 +32,14 @@ sub run { assert_script_run '! systemctl is-active sshd.service'; assert_script_run '! ps -C sshd'; script_run "reboot"; - $self->boot_to_login_screen("", 30); + boot_to_login_screen; $self->root_console(tty=>3); assert_script_run 'systemctl is-enabled sshd.service'; assert_script_run 'systemctl is-active sshd.service'; assert_script_run 'ps -C sshd'; script_run "systemctl disable sshd.service"; script_run "reboot"; - $self->boot_to_login_screen("", 30); + boot_to_login_screen; $self->root_console(tty=>3); assert_script_run '! systemctl is-enabled sshd.service'; assert_script_run '! systemctl is-active sshd.service'; diff --git a/tests/base_services_start.pm b/tests/base_services_start.pm index bcb0853d..2c5360ee 100644 --- a/tests/base_services_start.pm +++ b/tests/base_services_start.pm @@ -3,14 +3,7 @@ use strict; use testapi; sub run { - my $self=shift; - if (get_var("ARCH") eq "arm") { - # we cannot use boot_to_login_screen, wait_still_screen is unusable during ARM boot (it shows black screen for first few minutes) - assert_screen "text_console_login", 150; - } else { - # wait for boot to complete - $self->boot_to_login_screen("", 30); - } + my $self = shift; # switch to TTY3 for both, graphical and console tests $self->root_console(tty=>3); my $output = script_output 'systemctl --failed'; diff --git a/tests/base_update_cli.pm b/tests/base_update_cli.pm index 641e3fb2..5782f8ba 100644 --- a/tests/base_update_cli.pm +++ b/tests/base_update_cli.pm @@ -5,8 +5,6 @@ use packagetest; sub run { my $self = shift; - # wait for boot to complete - $self->boot_to_login_screen("", 30); # switch to TTY3 for both, graphical and console tests $self->root_console(tty=>3); # enable test repos and install test packages diff --git a/tests/database_client_postinstall.pm b/tests/database_client.pm similarity index 100% rename from tests/database_client_postinstall.pm rename to tests/database_client.pm diff --git a/tests/desktop_browser_postinstall.pm b/tests/desktop_browser.pm similarity index 100% rename from tests/desktop_browser_postinstall.pm rename to tests/desktop_browser.pm diff --git a/tests/desktop_notifications_postinstall.pm b/tests/desktop_notifications.pm similarity index 100% rename from tests/desktop_notifications_postinstall.pm rename to tests/desktop_notifications.pm diff --git a/tests/desktop_terminal_postinstall.pm b/tests/desktop_terminal.pm similarity index 100% rename from tests/desktop_terminal_postinstall.pm rename to tests/desktop_terminal.pm diff --git a/tests/desktop_update_graphical_postinstall.pm b/tests/desktop_update_graphical.pm similarity index 98% rename from tests/desktop_update_graphical_postinstall.pm rename to tests/desktop_update_graphical.pm index 9f689998..cb92bffd 100644 --- a/tests/desktop_update_graphical_postinstall.pm +++ b/tests/desktop_update_graphical.pm @@ -61,7 +61,7 @@ sub run { if (check_screen 'gnome_reboot_confirm', 15) { send_key 'ret'; } - assert_screen 'graphical_login', 300; + boot_to_login_screen; } else { # KDE will prompt for authentication if any package is not diff --git a/tests/firewall_configured_postinstall.pm b/tests/firewall_configured.pm similarity index 100% rename from tests/firewall_configured_postinstall.pm rename to tests/firewall_configured.pm diff --git a/tests/firewall_disabled_postinstall.pm b/tests/firewall_disabled.pm similarity index 100% rename from tests/firewall_disabled_postinstall.pm rename to tests/firewall_disabled.pm diff --git a/tests/freeipa_client_postinstall.pm b/tests/freeipa_client.pm similarity index 100% rename from tests/freeipa_client_postinstall.pm rename to tests/freeipa_client.pm diff --git a/tests/freeipa_password_change_postinstall.pm b/tests/freeipa_password_change.pm similarity index 100% rename from tests/freeipa_password_change_postinstall.pm rename to tests/freeipa_password_change.pm diff --git a/tests/freeipa_webui_postinstall.pm b/tests/freeipa_webui.pm similarity index 100% rename from tests/freeipa_webui_postinstall.pm rename to tests/freeipa_webui.pm diff --git a/tests/realmd_join_cockpit_postinstall.pm b/tests/realmd_join_cockpit.pm similarity index 100% rename from tests/realmd_join_cockpit_postinstall.pm rename to tests/realmd_join_cockpit.pm diff --git a/tests/realmd_join_sssd_postinstall.pm b/tests/realmd_join_sssd.pm similarity index 100% rename from tests/realmd_join_sssd_postinstall.pm rename to tests/realmd_join_sssd.pm diff --git a/tests/role_deploy_database_server_postinstall.pm b/tests/role_deploy_database_server.pm similarity index 100% rename from tests/role_deploy_database_server_postinstall.pm rename to tests/role_deploy_database_server.pm diff --git a/tests/role_deploy_domain_controller.pm b/tests/role_deploy_domain_controller.pm index 9184b704..c7858e87 100644 --- a/tests/role_deploy_domain_controller.pm +++ b/tests/role_deploy_domain_controller.pm @@ -5,11 +5,7 @@ use lockapi; use mmapi; sub run { - my $self=shift; - # boot with kernel params to ensure interface is 'eth0' and not whatever - # systemd feels like calling it today - $self->do_bootloader(postinstall=>1, params=>"net.ifnames=0 biosdevname=0"); - $self->boot_to_login_screen("text_console_login", 5, 60); + my $self = shift; # login $self->root_console(); # clone host's /etc/hosts (for phx2 internal routing to work) diff --git a/tests/server_cockpit_basic_postinstall.pm b/tests/server_cockpit_basic.pm similarity index 100% rename from tests/server_cockpit_basic_postinstall.pm rename to tests/server_cockpit_basic.pm diff --git a/tests/server_cockpit_default_postinstall.pm b/tests/server_cockpit_default.pm similarity index 100% rename from tests/server_cockpit_default_postinstall.pm rename to tests/server_cockpit_default.pm diff --git a/tests/server_firewall_default_postinstall.pm b/tests/server_firewall_default.pm similarity index 100% rename from tests/server_firewall_default_postinstall.pm rename to tests/server_firewall_default.pm diff --git a/tests/upgrade_preinstall.pm b/tests/upgrade_preinstall.pm index 040d0879..c2e3a076 100644 --- a/tests/upgrade_preinstall.pm +++ b/tests/upgrade_preinstall.pm @@ -1,6 +1,7 @@ use base "installedtest"; use strict; use testapi; +use main_common; sub run { my $self = shift; @@ -9,21 +10,14 @@ sub run { $self->boot_decrypt(60); } - # wait for either graphical or text login - if (get_var('DESKTOP')) { - $self->boot_to_login_screen("graphical_login", 45, 120); # DM takes time to load - } else { - $self->boot_to_login_screen(); - } + boot_to_login_screen; # switch to TTY3 for both, graphical and console tests $self->root_console(tty=>3); # disable screen blanking (update can take a long time) script_run "setterm -blank 0"; # upgrader should be installed on up-to-date system - assert_script_run 'dnf -y update', 1800; - script_run "reboot"; # decrypt if necessary @@ -31,11 +25,7 @@ sub run { $self->boot_decrypt(60); } - if (get_var('DESKTOP')) { - $self->boot_to_login_screen("graphical_login", 45, 120); # DM takes time to load - } else { - $self->boot_to_login_screen(); - } + boot_to_login_screen; $self->root_console(tty=>3); my $update_command = 'dnf -y install dnf-plugin-system-upgrade';