consolidate login waits, use postinstall not entrypoint for base

Summary:
I started out wanting to fix an issue I noticed today where
graphical upgrade tests were failing because they didn't wait
for the graphical login screen properly; the test was sitting
at the 'full Fedora logo' state of plymouth for a long time,
so the current boot_to_login_screen's wait_still_screen was
triggered by it and the function wound up failing on the
assert_screen, because it was still some time before the real
login screen appeared.

So I tweaked the boot_to_login_screen implementation to work
slightly differently (look for a login screen match, *then* -
if we're dealing with a graphical login - wait_still_screen
to defeat the 'old GPU buffer showing login screen' problem
and assert the login screen again). But while working on it,
I figured we really should consolidate all the various places
that handle the bootloader -> login, we were doing it quite
differently in all sorts of different places. And as part of
that, I converted the base tests to use POSTINSTALL (and thus
go through the shared _wait_login tests) instead of handling
boot themselves. As part of *that*, I tweaked main.pm to not
require all POSTINSTALL tests have the _postinstall suffix on
their names, as it really doesn't make sense, and renamed the
tests.

Test Plan: Run all tests, see if they work.

Reviewers: jskladan, garretraziel

Reviewed By: garretraziel

Subscribers: tflink

Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1015
This commit is contained in:
Adam Williamson 2016-09-27 11:48:15 -07:00
parent b4dc92ce67
commit e9ce14a891
38 changed files with 72 additions and 122 deletions

View File

@ -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.

View File

@ -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";
}
}

10
main.pm
View File

@ -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;
}

View File

@ -11,6 +11,7 @@
"properties": [],
"tags": [
"text_console_login",
"login_screen",
"ENV-DISTRI-fedora",
"ENV-FLAVOR-develop"
]

View File

@ -1,6 +1,7 @@
{
"tags": [
"graphical_login",
"login_screen",
"DESKTOP-gnome",
"ENV-DISTRI-fedora",
"LANGUAGE-english",

View File

@ -18,6 +18,7 @@
],
"tags": [
"graphical_login",
"login_screen",
"DESKTOP-kde",
"LANGUAGE-english",
"ENV-FLAVOR-kde_live"

View File

@ -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": []
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@ -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"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 KiB

View File

@ -18,6 +18,7 @@
],
"tags": [
"graphical_login",
"login_screen",
"DESKTOP-kde",
"LANGUAGE-english",
"ENV-FLAVOR-kde_live"

View File

@ -1,6 +1,7 @@
{
"tags": [
"graphical_login",
"login_screen",
"DESKTOP-kde",
"LANGUAGE-english",
"ENV-FLAVOR-kde_live"

View File

@ -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" },
],
},
{

View File

@ -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") {

View File

@ -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') {

View File

@ -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/ };

View File

@ -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);
# 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';

View File

@ -4,13 +4,6 @@ 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);
}
# switch to TTY3 for both, graphical and console tests
$self->root_console(tty=>3);
my $output = script_output 'systemctl --failed';

View File

@ -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

View File

@ -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

View File

@ -6,10 +6,6 @@ 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);
# login
$self->root_console();
# clone host's /etc/hosts (for phx2 internal routing to work)

View File

@ -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';