2017-01-18 07:15:44 +00:00
|
|
|
package utils;
|
2016-09-07 08:34:54 +00:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
use base 'Exporter';
|
|
|
|
use Exporter;
|
|
|
|
|
2017-01-18 07:15:44 +00:00
|
|
|
use lockapi;
|
2016-09-07 08:34:54 +00:00
|
|
|
use testapi;
|
2019-10-29 22:12:04 +00:00
|
|
|
our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader boot_decrypt check_release menu_launch_type repo_setup gnome_initial_setup anaconda_create_user check_desktop_clean download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut lo_dismiss_tip disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile bypass_1691487 get_release_number check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log click_unwanted_notifications repos_mirrorlist register_application get_registered_applications/;
|
2019-09-19 14:03:50 +00:00
|
|
|
|
|
|
|
# We introduce this global variable to hold the list of applications that have
|
|
|
|
# registered during the apps_startstop_test when they have sucessfully run.
|
|
|
|
our @application_list;
|
2016-09-07 08:34:54 +00:00
|
|
|
|
|
|
|
sub run_with_error_check {
|
|
|
|
my ($func, $error_screen) = @_;
|
2019-11-06 12:55:27 +00:00
|
|
|
# Check screen does not work for serial console, so we need to use
|
|
|
|
# different checking mechanism for it.
|
|
|
|
if (testapi::is_serial_terminal) {
|
|
|
|
# by using 'unless' and 'expect_not_found=>1' here we avoid
|
|
|
|
# the web UI showing each failure to see the error message as
|
|
|
|
# a 'failed match'
|
|
|
|
die "Error screen appeared" unless (wait_serial($error_screen, timeout=>5, expect_not_found=>1));
|
|
|
|
$func->();
|
|
|
|
die "Error screen appeared" unless (wait_serial($error_screen, timeout=>5, expect_not_found=>1));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
die "Error screen appeared" if (check_screen $error_screen, 5);
|
|
|
|
$func->();
|
|
|
|
die "Error screen appeared" if (check_screen $error_screen, 5);
|
|
|
|
}
|
2016-09-07 08:34:54 +00:00
|
|
|
}
|
2016-09-12 17:24:30 +00:00
|
|
|
|
|
|
|
# high-level 'type this string quite safely but reasonably fast'
|
|
|
|
# function whose specific implementation may vary
|
|
|
|
sub type_safely {
|
|
|
|
my $string = shift;
|
2016-10-20 16:12:55 +00:00
|
|
|
type_string($string, wait_screen_change => 3, max_interval => 20);
|
2019-07-25 21:57:00 +00:00
|
|
|
# similarity level 45 as there will commonly be a flashing
|
|
|
|
# cursor and the default level (47) is slightly too tight
|
|
|
|
wait_still_screen(stilltime=>2, similarity_level=>45);
|
2016-09-12 17:24:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# high-level 'type this string extremely safely and rather slow'
|
|
|
|
# function whose specific implementation may vary
|
|
|
|
sub type_very_safely {
|
|
|
|
my $string = shift;
|
2016-10-20 16:12:55 +00:00
|
|
|
type_string($string, wait_screen_change => 1, max_interval => 1);
|
2019-07-05 22:58:22 +00:00
|
|
|
# similarity level 45 as there will commonly be a flashing
|
|
|
|
# cursor and the default level (47) is slightly too tight
|
|
|
|
wait_still_screen(stilltime=>5, similarity_level=>45);
|
2016-09-12 17:24:30 +00:00
|
|
|
}
|
2016-09-24 19:42:39 +00:00
|
|
|
|
|
|
|
# Figure out what tty the desktop is on, switch to it. Assumes we're
|
|
|
|
# at a root console
|
|
|
|
sub desktop_vt {
|
2019-09-03 23:19:08 +00:00
|
|
|
# use loginctl or ps to find the tty of test's session (loginctl)
|
|
|
|
# or Xwayland or Xorg (ps); as of 2019-09 on F31 update tests
|
|
|
|
# ps -C is giving 'tty?', so adding loginctl works around that
|
2016-09-24 19:42:39 +00:00
|
|
|
my $xout;
|
|
|
|
# don't fail test if we don't find any process, just guess tty1
|
2019-09-03 23:19:08 +00:00
|
|
|
eval { $xout = script_output ' loginctl | grep test; ps -C Xwayland,Xorg -o tty --no-headers'; };
|
2016-09-24 19:42:39 +00:00
|
|
|
my $tty = 1; # default
|
|
|
|
while ($xout =~ /tty(\d)/g) {
|
|
|
|
$tty = $1; # most recent match is probably best
|
|
|
|
}
|
|
|
|
send_key "ctrl-alt-f${tty}";
|
2019-11-05 20:13:33 +00:00
|
|
|
# work around https://gitlab.gnome.org/GNOME/gnome-software/issues/582
|
|
|
|
# if it happens. As of 2019-05, seeing something similar on KDE too
|
|
|
|
my $desktop = get_var('DESKTOP');
|
|
|
|
if (check_screen "auth_required", 10) {
|
|
|
|
record_soft_failure "spurious 'auth required' - https://gitlab.gnome.org/GNOME/gnome-software/issues/582";
|
|
|
|
assert_and_click "auth_required" if ($desktop eq 'kde');
|
|
|
|
# bit sloppy but correct for both...
|
|
|
|
type_very_safely "weakpassword\n";
|
|
|
|
# as of 2019-04 when we hit this bug it seems to ask for
|
|
|
|
# auth *twice*, so handle that
|
|
|
|
sleep 3;
|
|
|
|
if (check_screen "auth_required", 1) {
|
|
|
|
type_very_safely "weakpassword\n";
|
|
|
|
}
|
|
|
|
}
|
2016-09-24 19:42:39 +00:00
|
|
|
}
|
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
2016-09-27 18:48:15 +00:00
|
|
|
|
|
|
|
# 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;
|
2019-11-06 12:55:27 +00:00
|
|
|
if (testapi::is_serial_terminal) {
|
|
|
|
# For serial console, just wait for the login prompt
|
|
|
|
unless (wait_serial "login:", timeout=>$args{timeout}) {
|
|
|
|
die "No login prompt shown on serial console.";
|
|
|
|
}
|
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
2016-09-27 18:48:15 +00:00
|
|
|
}
|
2019-11-06 12:55:27 +00:00
|
|
|
else {
|
|
|
|
# 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).
|
|
|
|
# The following is true for non-serial console.
|
|
|
|
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";
|
|
|
|
}
|
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
2016-09-27 18:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
redo console_login with multiple matches, move to main_common
Summary:
Since we can match on multiple needles, we can drop the loop
from console_login and instead do it this way, which is simpler
and should work better on ARM (the timeouts will scale and
allow ARM to be slow here). Also move it to main_common as
there's no logical reason for it to be a class method.
Also remove the `check` arg. `check` was only set to 0 by two
tests, _console_shutdown and anacondatest's _post_fail_hook.
For _console_shutdown, I think I just wanted to give it the
best possible chance of succeeding. But we're really not going
to lose anything significant by checking, the only case where
check=>0 would've helped is if the 'good' needle had stopped
matching, and all sorts of other tests will fail in that case.
anacondatest was only using it to save a screenshot of whatever
was on the tty if it didn't reach a root console, which doesn't
seem that useful, and we'll get screenshots from check_screen
and assert_screen anyway.
Test Plan:
Run all tests, check they behave as expected and
none inappropriately fails on console login.
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1016
2016-09-30 15:42:45 +00:00
|
|
|
|
|
|
|
# Switch keyboard layouts at a console
|
|
|
|
sub console_switch_layout {
|
|
|
|
# switcher key combo differs between layouts, for console
|
|
|
|
if (get_var("LANGUAGE", "") eq "russian") {
|
|
|
|
send_key "ctrl-shift";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-21 16:41:00 +00:00
|
|
|
# switch to 'native' or 'ascii' input method in a graphical desktop
|
|
|
|
# usually switched configs have one mode for inputting ascii-ish
|
|
|
|
# characters (which may be 'us' keyboard layout, or a local layout for
|
|
|
|
# inputting ascii like 'jp') and one mode for inputting native
|
|
|
|
# characters (which may be another keyboard layout, like 'ru', or an
|
|
|
|
# input method for more complex languages)
|
2016-12-16 17:40:29 +00:00
|
|
|
# 'environment' can be a desktop name or 'anaconda' for anaconda
|
|
|
|
# if not set, will use get_var('DESKTOP') or default 'anaconda'
|
|
|
|
sub desktop_switch_layout {
|
|
|
|
my ($layout, $environment) = @_;
|
2016-12-21 16:41:00 +00:00
|
|
|
$layout //= 'ascii';
|
2016-12-16 17:40:29 +00:00
|
|
|
$environment //= get_var("DESKTOP", "anaconda");
|
|
|
|
# if already selected, we're good
|
|
|
|
return if (check_screen "${environment}_layout_${layout}", 3);
|
|
|
|
# otherwise we need to switch
|
|
|
|
my $switcher = "alt-shift"; # anaconda
|
|
|
|
$switcher = "super-spc" if $environment eq 'gnome';
|
|
|
|
# KDE? not used yet
|
|
|
|
send_key $switcher;
|
|
|
|
assert_screen "${environment}_layout_${layout}", 3;
|
|
|
|
}
|
|
|
|
|
2017-08-31 18:39:07 +00:00
|
|
|
# this is used at the end of console_login to check if we got a prompt
|
|
|
|
# indicating that we got a bash shell, but sourcing of /etc/bashrc
|
|
|
|
# failed (the prompt looks different in this case). We treat this as
|
|
|
|
# a soft failure.
|
|
|
|
sub _console_login_finish {
|
2019-11-06 12:55:27 +00:00
|
|
|
# The check differs according to the console used.
|
|
|
|
if (testapi::is_serial_terminal) {
|
|
|
|
unless (wait_serial("-bash-.*[#\$]", timeout=>5, expect_not_found=>1)) {
|
|
|
|
record_soft_failure "It looks like profile sourcing failed";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (match_has_tag "bash_noprofile") {
|
|
|
|
record_soft_failure "It looks like profile sourcing failed";
|
|
|
|
}
|
2017-08-31 18:39:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
redo console_login with multiple matches, move to main_common
Summary:
Since we can match on multiple needles, we can drop the loop
from console_login and instead do it this way, which is simpler
and should work better on ARM (the timeouts will scale and
allow ARM to be slow here). Also move it to main_common as
there's no logical reason for it to be a class method.
Also remove the `check` arg. `check` was only set to 0 by two
tests, _console_shutdown and anacondatest's _post_fail_hook.
For _console_shutdown, I think I just wanted to give it the
best possible chance of succeeding. But we're really not going
to lose anything significant by checking, the only case where
check=>0 would've helped is if the 'good' needle had stopped
matching, and all sorts of other tests will fail in that case.
anacondatest was only using it to save a screenshot of whatever
was on the tty if it didn't reach a root console, which doesn't
seem that useful, and we'll get screenshots from check_screen
and assert_screen anyway.
Test Plan:
Run all tests, check they behave as expected and
none inappropriately fails on console login.
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1016
2016-09-30 15:42:45 +00:00
|
|
|
# this subroutine handles logging in as a root/specified user into console
|
|
|
|
# it requires TTY to be already displayed (handled by the root_console()
|
|
|
|
# method of distribution classes)
|
|
|
|
sub console_login {
|
|
|
|
my %args = (
|
|
|
|
user => "root",
|
|
|
|
password => get_var("ROOT_PASSWORD", "weakpassword"),
|
2018-10-06 15:44:34 +00:00
|
|
|
# default is 10 seconds, set below, 0 means 'default'
|
2018-10-06 15:52:08 +00:00
|
|
|
timeout => 0,
|
redo console_login with multiple matches, move to main_common
Summary:
Since we can match on multiple needles, we can drop the loop
from console_login and instead do it this way, which is simpler
and should work better on ARM (the timeouts will scale and
allow ARM to be slow here). Also move it to main_common as
there's no logical reason for it to be a class method.
Also remove the `check` arg. `check` was only set to 0 by two
tests, _console_shutdown and anacondatest's _post_fail_hook.
For _console_shutdown, I think I just wanted to give it the
best possible chance of succeeding. But we're really not going
to lose anything significant by checking, the only case where
check=>0 would've helped is if the 'good' needle had stopped
matching, and all sorts of other tests will fail in that case.
anacondatest was only using it to save a screenshot of whatever
was on the tty if it didn't reach a root console, which doesn't
seem that useful, and we'll get screenshots from check_screen
and assert_screen anyway.
Test Plan:
Run all tests, check they behave as expected and
none inappropriately fails on console login.
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1016
2016-09-30 15:42:45 +00:00
|
|
|
@_);
|
2018-10-06 15:44:34 +00:00
|
|
|
$args{timeout} ||= 10;
|
redo console_login with multiple matches, move to main_common
Summary:
Since we can match on multiple needles, we can drop the loop
from console_login and instead do it this way, which is simpler
and should work better on ARM (the timeouts will scale and
allow ARM to be slow here). Also move it to main_common as
there's no logical reason for it to be a class method.
Also remove the `check` arg. `check` was only set to 0 by two
tests, _console_shutdown and anacondatest's _post_fail_hook.
For _console_shutdown, I think I just wanted to give it the
best possible chance of succeeding. But we're really not going
to lose anything significant by checking, the only case where
check=>0 would've helped is if the 'good' needle had stopped
matching, and all sorts of other tests will fail in that case.
anacondatest was only using it to save a screenshot of whatever
was on the tty if it didn't reach a root console, which doesn't
seem that useful, and we'll get screenshots from check_screen
and assert_screen anyway.
Test Plan:
Run all tests, check they behave as expected and
none inappropriately fails on console login.
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1016
2016-09-30 15:42:45 +00:00
|
|
|
|
2019-11-06 12:55:27 +00:00
|
|
|
# Since we do not test many serial console tests, and we probably
|
|
|
|
# only want to test serial console on a minimal installation only,
|
|
|
|
# let us not do all the magic to handle different console logins
|
|
|
|
# and let us simplify the process.
|
|
|
|
# We will check if we are logged in, and if so, we will log out to
|
|
|
|
# enable a new proper login based on the user variable.
|
|
|
|
if (get_var("SERIAL_CONSOLE")) {
|
|
|
|
# Check for the usual prompt.
|
|
|
|
if (wait_serial("~\][#\$]", timeout=>5, quiet=>1)) {
|
|
|
|
type_string "logout\n";
|
|
|
|
# Wait a bit to let the logout properly finish.
|
|
|
|
sleep 10;
|
|
|
|
}
|
|
|
|
# Do the new login.
|
|
|
|
type_string $args{user};
|
|
|
|
type_string "\n";
|
|
|
|
sleep 2;
|
|
|
|
type_string $args{password};
|
|
|
|
type_string "\n";
|
|
|
|
# Let's perform a simple login test. This is the same as
|
|
|
|
# whoami, but has the advantage of existing in installer env
|
|
|
|
assert_script_run "id -un";
|
|
|
|
unless (wait_serial $args{user}, timeout=>5) {
|
|
|
|
die "Logging onto the serial console has failed.";
|
|
|
|
}
|
redo console_login with multiple matches, move to main_common
Summary:
Since we can match on multiple needles, we can drop the loop
from console_login and instead do it this way, which is simpler
and should work better on ARM (the timeouts will scale and
allow ARM to be slow here). Also move it to main_common as
there's no logical reason for it to be a class method.
Also remove the `check` arg. `check` was only set to 0 by two
tests, _console_shutdown and anacondatest's _post_fail_hook.
For _console_shutdown, I think I just wanted to give it the
best possible chance of succeeding. But we're really not going
to lose anything significant by checking, the only case where
check=>0 would've helped is if the 'good' needle had stopped
matching, and all sorts of other tests will fail in that case.
anacondatest was only using it to save a screenshot of whatever
was on the tty if it didn't reach a root console, which doesn't
seem that useful, and we'll get screenshots from check_screen
and assert_screen anyway.
Test Plan:
Run all tests, check they behave as expected and
none inappropriately fails on console login.
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1016
2016-09-30 15:42:45 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-11-06 12:55:27 +00:00
|
|
|
# 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 few seconds before starting
|
|
|
|
sleep 4;
|
redo console_login with multiple matches, move to main_common
Summary:
Since we can match on multiple needles, we can drop the loop
from console_login and instead do it this way, which is simpler
and should work better on ARM (the timeouts will scale and
allow ARM to be slow here). Also move it to main_common as
there's no logical reason for it to be a class method.
Also remove the `check` arg. `check` was only set to 0 by two
tests, _console_shutdown and anacondatest's _post_fail_hook.
For _console_shutdown, I think I just wanted to give it the
best possible chance of succeeding. But we're really not going
to lose anything significant by checking, the only case where
check=>0 would've helped is if the 'good' needle had stopped
matching, and all sorts of other tests will fail in that case.
anacondatest was only using it to save a screenshot of whatever
was on the tty if it didn't reach a root console, which doesn't
seem that useful, and we'll get screenshots from check_screen
and assert_screen anyway.
Test Plan:
Run all tests, check they behave as expected and
none inappropriately fails on console login.
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1016
2016-09-30 15:42:45 +00:00
|
|
|
|
2019-11-06 12:55:27 +00:00
|
|
|
my $good = "";
|
|
|
|
my $bad = "";
|
|
|
|
if ($args{user} eq "root") {
|
|
|
|
$good = "root_console";
|
|
|
|
$bad = "user_console";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$good = "user_console";
|
|
|
|
$bad = "root_console";
|
|
|
|
}
|
redo console_login with multiple matches, move to main_common
Summary:
Since we can match on multiple needles, we can drop the loop
from console_login and instead do it this way, which is simpler
and should work better on ARM (the timeouts will scale and
allow ARM to be slow here). Also move it to main_common as
there's no logical reason for it to be a class method.
Also remove the `check` arg. `check` was only set to 0 by two
tests, _console_shutdown and anacondatest's _post_fail_hook.
For _console_shutdown, I think I just wanted to give it the
best possible chance of succeeding. But we're really not going
to lose anything significant by checking, the only case where
check=>0 would've helped is if the 'good' needle had stopped
matching, and all sorts of other tests will fail in that case.
anacondatest was only using it to save a screenshot of whatever
was on the tty if it didn't reach a root console, which doesn't
seem that useful, and we'll get screenshots from check_screen
and assert_screen anyway.
Test Plan:
Run all tests, check they behave as expected and
none inappropriately fails on console login.
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1016
2016-09-30 15:42:45 +00:00
|
|
|
|
2019-11-06 12:55:27 +00:00
|
|
|
if (check_screen $bad, 0) {
|
|
|
|
# we don't want to 'wait' for this as it won't return
|
|
|
|
script_run "exit", 0;
|
|
|
|
sleep 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
assert_screen [$good, 'text_console_login'], $args{timeout};
|
|
|
|
# if we're already logged in, all is good
|
|
|
|
if (match_has_tag $good) {
|
|
|
|
_console_login_finish();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
# otherwise, we saw the login prompt, type the username
|
|
|
|
type_string("$args{user}\n");
|
|
|
|
assert_screen [$good, 'console_password_required'], 30;
|
|
|
|
# on a live image, just the user name will be enough
|
|
|
|
if (match_has_tag $good) {
|
2019-12-14 17:06:12 +00:00
|
|
|
# clear the screen (so the remaining login prompt text
|
|
|
|
# doesn't confuse subsequent runs of this)
|
|
|
|
my $clearstr = "clear\n";
|
|
|
|
$clearstr = "cleqr\n" if (get_var("LANGUAGE") eq 'french');
|
|
|
|
type_string $clearstr;
|
2019-11-06 12:55:27 +00:00
|
|
|
_console_login_finish();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
# otherwise, type the password
|
redo console_login with multiple matches, move to main_common
Summary:
Since we can match on multiple needles, we can drop the loop
from console_login and instead do it this way, which is simpler
and should work better on ARM (the timeouts will scale and
allow ARM to be slow here). Also move it to main_common as
there's no logical reason for it to be a class method.
Also remove the `check` arg. `check` was only set to 0 by two
tests, _console_shutdown and anacondatest's _post_fail_hook.
For _console_shutdown, I think I just wanted to give it the
best possible chance of succeeding. But we're really not going
to lose anything significant by checking, the only case where
check=>0 would've helped is if the 'good' needle had stopped
matching, and all sorts of other tests will fail in that case.
anacondatest was only using it to save a screenshot of whatever
was on the tty if it didn't reach a root console, which doesn't
seem that useful, and we'll get screenshots from check_screen
and assert_screen anyway.
Test Plan:
Run all tests, check they behave as expected and
none inappropriately fails on console login.
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1016
2016-09-30 15:42:45 +00:00
|
|
|
type_string "$args{password}";
|
2019-11-06 12:55:27 +00:00
|
|
|
if (get_var("SWITCHED_LAYOUT") and $args{user} ne "root") {
|
|
|
|
# see _do_install_and_reboot; when layout is switched
|
|
|
|
# user password is doubled to contain both US and native
|
|
|
|
# chars
|
|
|
|
console_switch_layout;
|
|
|
|
type_string "$args{password}";
|
|
|
|
console_switch_layout;
|
|
|
|
}
|
|
|
|
send_key "ret";
|
|
|
|
# make sure we reached the console
|
|
|
|
unless (check_screen($good, 30)) {
|
|
|
|
# as of 2018-10 we have a bug in sssd which makes this take
|
|
|
|
# unusually long in the FreeIPA tests, let's allow longer,
|
|
|
|
# with a soft fail - RHBZ #1644919
|
|
|
|
record_soft_failure "Console login is taking a long time - #1644919?";
|
|
|
|
my $timeout = 30;
|
|
|
|
# even an extra 30 secs isn't long enough on aarch64...
|
|
|
|
$timeout = 90 if (get_var("ARCH") eq "aarch64");
|
|
|
|
assert_screen($good, $timeout);
|
|
|
|
}
|
2019-12-14 17:06:12 +00:00
|
|
|
# clear the screen (so the remaining login prompt text
|
|
|
|
# doesn't confuse subsequent runs of this)
|
|
|
|
my $clearstr = "clear\n";
|
|
|
|
$clearstr = "cleqr\n" if (get_var("LANGUAGE") eq 'french');
|
|
|
|
type_string $clearstr;
|
2018-10-31 23:33:32 +00:00
|
|
|
}
|
2017-08-31 18:39:07 +00:00
|
|
|
_console_login_finish();
|
redo console_login with multiple matches, move to main_common
Summary:
Since we can match on multiple needles, we can drop the loop
from console_login and instead do it this way, which is simpler
and should work better on ARM (the timeouts will scale and
allow ARM to be slow here). Also move it to main_common as
there's no logical reason for it to be a class method.
Also remove the `check` arg. `check` was only set to 0 by two
tests, _console_shutdown and anacondatest's _post_fail_hook.
For _console_shutdown, I think I just wanted to give it the
best possible chance of succeeding. But we're really not going
to lose anything significant by checking, the only case where
check=>0 would've helped is if the 'good' needle had stopped
matching, and all sorts of other tests will fail in that case.
anacondatest was only using it to save a screenshot of whatever
was on the tty if it didn't reach a root console, which doesn't
seem that useful, and we'll get screenshots from check_screen
and assert_screen anyway.
Test Plan:
Run all tests, check they behave as expected and
none inappropriately fails on console login.
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1016
2016-09-30 15:42:45 +00:00
|
|
|
}
|
2016-12-08 20:03:26 +00:00
|
|
|
|
|
|
|
# load US layout (from a root console)
|
|
|
|
sub console_loadkeys_us {
|
|
|
|
if (get_var('LANGUAGE') eq 'french') {
|
|
|
|
script_run "loqdkeys us", 0;
|
2018-06-25 17:31:53 +00:00
|
|
|
# might take a few secs
|
|
|
|
sleep 3;
|
2016-12-08 20:03:26 +00:00
|
|
|
}
|
2018-06-25 16:34:49 +00:00
|
|
|
elsif (get_var('LANGUAGE') eq 'japanese') {
|
|
|
|
script_run "loadkeys us", 0;
|
2018-06-25 17:31:53 +00:00
|
|
|
sleep 3;
|
2018-06-25 16:34:49 +00:00
|
|
|
}
|
2016-12-08 20:03:26 +00:00
|
|
|
}
|
2017-01-18 07:15:44 +00:00
|
|
|
|
|
|
|
sub do_bootloader {
|
|
|
|
# Handle bootloader screen. 'bootloader' is syslinux or grub.
|
|
|
|
# 'uefi' is whether this is a UEFI install, will get_var UEFI if
|
|
|
|
# not explicitly set. 'postinstall' is whether we're on an
|
|
|
|
# installed system or at the installer (this matters for how many
|
|
|
|
# times we press 'down' to find the kernel line when typing args).
|
|
|
|
# 'args' is a string of extra kernel args, if desired. 'mutex' is
|
|
|
|
# a parallel test mutex lock to wait for before proceeding, if
|
|
|
|
# desired. 'first' is whether to hit 'up' a couple of times to
|
|
|
|
# make sure we boot the first menu entry. 'timeout' is how long to
|
|
|
|
# wait for the bootloader screen.
|
|
|
|
my %args = (
|
|
|
|
postinstall => 0,
|
|
|
|
params => "",
|
|
|
|
mutex => "",
|
|
|
|
first => 1,
|
|
|
|
timeout => 30,
|
|
|
|
uefi => get_var("UEFI"),
|
2016-11-09 08:16:00 +00:00
|
|
|
ofw => get_var("OFW"),
|
2017-01-18 07:15:44 +00:00
|
|
|
@_
|
|
|
|
);
|
2016-11-09 08:16:00 +00:00
|
|
|
# if not postinstall not UEFI and not ofw, syslinux
|
|
|
|
$args{bootloader} //= ($args{uefi} || $args{postinstall} || $args{ofw}) ? "grub" : "syslinux";
|
2018-08-18 20:50:23 +00:00
|
|
|
# we use the firmware-type specific tags because we want to be
|
|
|
|
# sure we actually did a UEFI boot
|
|
|
|
my $boottag = "bootloader_bios";
|
|
|
|
$boottag = "bootloader_uefi" if ($args{uefi});
|
2019-04-29 16:49:03 +00:00
|
|
|
assert_screen $boottag, $args{timeout};
|
2017-01-18 07:15:44 +00:00
|
|
|
if ($args{mutex}) {
|
|
|
|
# cancel countdown
|
|
|
|
send_key "left";
|
|
|
|
mutex_lock $args{mutex};
|
|
|
|
mutex_unlock $args{mutex};
|
|
|
|
}
|
|
|
|
if ($args{first}) {
|
|
|
|
# press up a couple of times to make sure we're at first entry
|
|
|
|
send_key "up";
|
|
|
|
send_key "up";
|
|
|
|
}
|
|
|
|
if ($args{params}) {
|
|
|
|
if ($args{bootloader} eq "syslinux") {
|
|
|
|
send_key "tab";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
send_key "e";
|
Simplify and improve how we get to 'linux' line in grub
That whole creaky edifice of conditionals that figured out how
many times to press 'down' was a mess I always hated, and I just
found out that the fix for BLS wasn't complete - I'd assumed in
writing it that systems weren't being migrated to BLS on upgrade
to F30, but actually they are. This makes that design very hard
as we'd have had to find a way to change the number of 'down'
presses part-way through update tests, and all the ways I can
think of to do that would've made this even sillier.
Happily I managed to come up with what looks like a much simpler
approach: just go from the bottom. It seems that in every setup
I can think of to check - all three arches, BLS, no BLS, pre-
install, post-install - the linux line is two lines up from the
bottom of the config stanza (the last line is blank, and the
last line but one is the initramfs line). So we can just press
down 50 times (to make damn sure we're at the bottom) then press
up twice and we should be in the right place, no matter the arch,
the release, or if BLS is in use or not. Whew.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-11-30 22:17:01 +00:00
|
|
|
# we need to get to the 'linux' line here, and grub does
|
|
|
|
# not have any easy way to do that. Depending on the arch
|
|
|
|
# and the Fedora release, we may have to press 'down' 2
|
|
|
|
# times, or 13, or 12, or some other goddamn number. That
|
|
|
|
# got painful to keep track of, so let's go bottom-up:
|
|
|
|
# press 'down' 50 times to make sure we're at the bottom,
|
|
|
|
# then 'up' twice to reach the 'linux' line. This seems to
|
|
|
|
# work in every permutation I can think of to test.
|
|
|
|
for (1 .. 50) {
|
|
|
|
send_key 'down';
|
2017-01-18 07:15:44 +00:00
|
|
|
}
|
Simplify and improve how we get to 'linux' line in grub
That whole creaky edifice of conditionals that figured out how
many times to press 'down' was a mess I always hated, and I just
found out that the fix for BLS wasn't complete - I'd assumed in
writing it that systems weren't being migrated to BLS on upgrade
to F30, but actually they are. This makes that design very hard
as we'd have had to find a way to change the number of 'down'
presses part-way through update tests, and all the ways I can
think of to do that would've made this even sillier.
Happily I managed to come up with what looks like a much simpler
approach: just go from the bottom. It seems that in every setup
I can think of to check - all three arches, BLS, no BLS, pre-
install, post-install - the linux line is two lines up from the
bottom of the config stanza (the last line is blank, and the
last line but one is the initramfs line). So we can just press
down 50 times (to make damn sure we're at the bottom) then press
up twice and we should be in the right place, no matter the arch,
the release, or if BLS is in use or not. Whew.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-11-30 22:17:01 +00:00
|
|
|
sleep 1;
|
|
|
|
send_key 'up';
|
|
|
|
sleep 1;
|
|
|
|
send_key 'up';
|
2017-01-18 07:15:44 +00:00
|
|
|
send_key "end";
|
|
|
|
}
|
2016-11-09 08:16:00 +00:00
|
|
|
# Change type_string by type_safely because keyboard polling
|
|
|
|
# in SLOF usb-xhci driver failed sometimes in powerpc
|
|
|
|
type_safely " $args{params}";
|
2017-01-18 07:15:44 +00:00
|
|
|
}
|
2017-03-27 10:42:15 +00:00
|
|
|
save_screenshot; # for debug purpose
|
2017-01-18 07:15:44 +00:00
|
|
|
# ctrl-X boots from grub editor mode
|
|
|
|
send_key "ctrl-x";
|
|
|
|
# return boots all other cases
|
|
|
|
send_key "ret";
|
|
|
|
}
|
|
|
|
|
|
|
|
sub boot_decrypt {
|
|
|
|
# decrypt storage during boot; arg is timeout (in seconds)
|
|
|
|
my $timeout = shift || 60;
|
2019-04-29 16:49:03 +00:00
|
|
|
assert_screen "boot_enter_passphrase", $timeout;
|
2017-01-18 07:15:44 +00:00
|
|
|
type_string get_var("ENCRYPT_PASSWORD");
|
|
|
|
send_key "ret";
|
|
|
|
}
|
|
|
|
|
|
|
|
sub check_release {
|
|
|
|
# Checks whether the installed release matches a given value. E.g.
|
|
|
|
# `check_release(23)` checks whether the installed system is
|
|
|
|
# Fedora 23. The value can be 'Rawhide' or a Fedora release
|
|
|
|
# number; often you will want to use `get_var('VERSION')`. Expects
|
|
|
|
# a console prompt to be active when it is called.
|
|
|
|
my $release = shift;
|
2018-11-15 20:46:24 +00:00
|
|
|
my $check_command = "grep SUPPORT_PRODUCT_VERSION /etc/os-release";
|
2017-01-18 07:15:44 +00:00
|
|
|
validate_script_output $check_command, sub { $_ =~ m/REDHAT_SUPPORT_PRODUCT_VERSION=$release/ };
|
|
|
|
}
|
|
|
|
|
|
|
|
sub menu_launch_type {
|
|
|
|
# Launch an application in a graphical environment, by opening a
|
|
|
|
# launcher, typing the specified string and hitting enter. Pass
|
|
|
|
# the string to be typed to launch whatever it is you want.
|
|
|
|
my $app = shift;
|
|
|
|
# super does not work on KDE, because fml
|
|
|
|
send_key 'alt-f1';
|
|
|
|
# srsly KDE y u so slo
|
|
|
|
wait_still_screen 3;
|
|
|
|
type_very_safely $app;
|
|
|
|
send_key 'ret';
|
|
|
|
}
|
|
|
|
|
2019-02-21 18:35:51 +00:00
|
|
|
sub disable_firefox_studies {
|
|
|
|
# create a config file that disables Firefox's dumb 'shield
|
|
|
|
# studies' so they don't break tests:
|
|
|
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1529626
|
|
|
|
assert_script_run 'mkdir -p $(rpm --eval %_libdir)/firefox/distribution';
|
2019-02-26 18:57:26 +00:00
|
|
|
assert_script_run 'printf \'{"policies": {"DisableFirefoxStudies": true}}\' > $(rpm --eval %_libdir)/firefox/distribution/policies.json';
|
2019-02-21 18:35:51 +00:00
|
|
|
}
|
|
|
|
|
2019-08-20 21:16:23 +00:00
|
|
|
sub repos_mirrorlist {
|
|
|
|
# Use mirrorlist not metalink so we don't hit the timing issue where
|
|
|
|
# the infra repo is updated but mirrormanager metadata checksums
|
|
|
|
# have not been updated, and the infra repo is rejected as its
|
|
|
|
# metadata checksum isn't known to MM
|
|
|
|
my $files = shift;
|
2019-09-20 05:15:21 +00:00
|
|
|
$files ||= "/etc/yum.repos.d/fedora*.repo";
|
2019-08-20 21:16:23 +00:00
|
|
|
assert_script_run "sed -i -e 's,metalink,mirrorlist,g' ${files}";
|
|
|
|
}
|
|
|
|
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
sub _repo_setup_compose {
|
|
|
|
# Appropriate repo setup steps for testing a compose
|
2017-01-18 07:15:44 +00:00
|
|
|
# disable updates-testing and updates and use the compose location
|
|
|
|
# as the target for fedora and rawhide rather than mirrorlist, so
|
|
|
|
# tools see only packages from the compose under test
|
|
|
|
my $location = get_var("LOCATION");
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
return unless $location;
|
2018-03-26 19:16:58 +00:00
|
|
|
assert_script_run 'dnf config-manager --set-disabled updates-testing updates';
|
2018-03-26 19:28:48 +00:00
|
|
|
# script_run returns the exit code, so 'unless' here means 'if the file exists'
|
|
|
|
unless (script_run 'test -f /etc/yum.repos.d/fedora-updates-modular.repo') {
|
|
|
|
assert_script_run 'dnf config-manager --set-disabled updates-testing-modular updates-modular';
|
|
|
|
}
|
|
|
|
# we use script_run here as the rawhide and modular repo files
|
|
|
|
# won't always exist and we don't want to bother testing or
|
|
|
|
# predicting their existence; assert_script_run doesn't buy you
|
|
|
|
# much with sed as it'll return 0 even if it replaced nothing
|
Use mirrorlist instead of baseurl for updates tests
The reason we have all this horrible code to use the commented-
out baseurl lines in the repo files instead of the metalinks
that are usually used is a timing issue with the metalink
system. As a protection against stale mirrors, the metalink
system sends the package manager a list of mirrors *and a list
of recent checksums for the repo metadata*. The package manager
goes out and gets the metadata from the first mirror on the
list, then checksums it; if the checksum isn't on the list of
checksums it got from mirrormanager, it assumes that means the
mirror is stale, and tries the next on the list instead.
The problem is that MM's list of checksums is currently only
updated once an hour (by a cron job). So we kept running into
a problem where, when a test ran just after one of the repos
had been regenerated, the infra mirror it's supposed to use
would be rejected because the checksum wasn't on the list - but
not because the mirror was stale, but because it was too fresh,
it had got the new packages and metadata but mirrormanager's
list of checksums hadn't been updated to include the checksum
for the latest metadata.
All this baseurl munging code was getting ridiculous, though,
what with the tests getting more complicated and errors showing
up in the actual repo files and stuff. It occurred to me that
instead of using the baseurl we can just use the 'mirrorlist'
system instead of 'metalink'. mirrorlist is the dumber, older
system which just provides the package manager a list of mirrors
and nothing else - the whole stale-mirror-detection-checksum
thing does not happen with mirrorlists, the package manager just
tries all the mirrors in order and uses the first that works.
And happily, it's very easy to convert the metalink URLs into
mirrorlist URLs, and it saves all that faffing around trying to
fix up baseurls.
Also, adjust upgrade_boot to do the s/metalink/mirrorlist/
substitution, so upgrade tests don't run into the timing issue
in the steps before the main repo_setup run is done by
upgrade_run, and adjust repo_setup_compose to sub this line out
later.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-05-09 19:35:59 +00:00
|
|
|
script_run "sed -i -e 's,^metalink,#metalink,g' -e 's,^mirrorlist,#mirrorlist,g' -e 's,^#baseurl.*basearch,baseurl=${location}/Everything/\$basearch,g' -e 's,^#baseurl.*source,baseurl=${location}/Everything/source,g' /etc/yum.repos.d/{fedora,fedora-rawhide}.repo", 0;
|
|
|
|
script_run "sed -i -e 's,^metalink,#metalink,g' -e 's,^mirrorlist,#mirrorlist,g' -e 's,^#baseurl.*basearch,baseurl=${location}/Modular/\$basearch,g' -e 's,^#baseurl.*source,baseurl=${location}/Modular/source,g' /etc/yum.repos.d/{fedora-modular,fedora-rawhide-modular}.repo", 0;
|
2018-05-03 18:28:30 +00:00
|
|
|
|
|
|
|
# this can be used for debugging if something is going wrong
|
|
|
|
# unless (script_run 'pushd /etc/yum.repos.d && tar czvf yumreposd.tar.gz * && popd') {
|
|
|
|
# upload_logs "/etc/yum.repos.d/yumreposd.tar.gz";
|
|
|
|
# }
|
2017-01-18 07:15:44 +00:00
|
|
|
}
|
|
|
|
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
sub _repo_setup_updates {
|
|
|
|
# Appropriate repo setup steps for testing a Bodhi update
|
|
|
|
# Check if we already ran, bail if so
|
|
|
|
return unless script_run "test -f /etc/yum.repos.d/advisory.repo";
|
2019-12-11 20:02:21 +00:00
|
|
|
my $version = get_var("VERSION");
|
2019-08-21 18:28:39 +00:00
|
|
|
repos_mirrorlist();
|
2020-01-10 22:34:58 +00:00
|
|
|
# this can be used for debugging repo config if something is wrong
|
|
|
|
# unless (script_run 'pushd /etc/yum.repos.d && tar czvf yumreposd.tar.gz * && popd') {
|
|
|
|
# upload_logs "/etc/yum.repos.d/yumreposd.tar.gz";
|
|
|
|
# }
|
Use mirrorlist instead of baseurl for updates tests
The reason we have all this horrible code to use the commented-
out baseurl lines in the repo files instead of the metalinks
that are usually used is a timing issue with the metalink
system. As a protection against stale mirrors, the metalink
system sends the package manager a list of mirrors *and a list
of recent checksums for the repo metadata*. The package manager
goes out and gets the metadata from the first mirror on the
list, then checksums it; if the checksum isn't on the list of
checksums it got from mirrormanager, it assumes that means the
mirror is stale, and tries the next on the list instead.
The problem is that MM's list of checksums is currently only
updated once an hour (by a cron job). So we kept running into
a problem where, when a test ran just after one of the repos
had been regenerated, the infra mirror it's supposed to use
would be rejected because the checksum wasn't on the list - but
not because the mirror was stale, but because it was too fresh,
it had got the new packages and metadata but mirrormanager's
list of checksums hadn't been updated to include the checksum
for the latest metadata.
All this baseurl munging code was getting ridiculous, though,
what with the tests getting more complicated and errors showing
up in the actual repo files and stuff. It occurred to me that
instead of using the baseurl we can just use the 'mirrorlist'
system instead of 'metalink'. mirrorlist is the dumber, older
system which just provides the package manager a list of mirrors
and nothing else - the whole stale-mirror-detection-checksum
thing does not happen with mirrorlists, the package manager just
tries all the mirrors in order and uses the first that works.
And happily, it's very easy to convert the metalink URLs into
mirrorlist URLs, and it saves all that faffing around trying to
fix up baseurls.
Also, adjust upgrade_boot to do the s/metalink/mirrorlist/
substitution, so upgrade tests don't run into the timing issue
in the steps before the main repo_setup run is done by
upgrade_run, and adjust repo_setup_compose to sub this line out
later.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-05-09 19:35:59 +00:00
|
|
|
if (get_var("DEVELOPMENT")) {
|
|
|
|
# Disable updates-testing so other bad updates don't break us
|
|
|
|
# this will do nothing on upgrade tests as we're on a stable
|
|
|
|
# release at this point, but it won't *hurt* anything, so no
|
|
|
|
# need to except that case really
|
|
|
|
assert_script_run "dnf config-manager --set-disabled updates-testing";
|
|
|
|
# same for Modular, if appropriate
|
|
|
|
unless (script_run 'test -f /etc/yum.repos.d/fedora-updates-modular.repo') {
|
|
|
|
assert_script_run "dnf config-manager --set-disabled updates-testing-modular";
|
|
|
|
}
|
2018-05-03 18:51:50 +00:00
|
|
|
}
|
Use mirrorlist instead of baseurl for updates tests
The reason we have all this horrible code to use the commented-
out baseurl lines in the repo files instead of the metalinks
that are usually used is a timing issue with the metalink
system. As a protection against stale mirrors, the metalink
system sends the package manager a list of mirrors *and a list
of recent checksums for the repo metadata*. The package manager
goes out and gets the metadata from the first mirror on the
list, then checksums it; if the checksum isn't on the list of
checksums it got from mirrormanager, it assumes that means the
mirror is stale, and tries the next on the list instead.
The problem is that MM's list of checksums is currently only
updated once an hour (by a cron job). So we kept running into
a problem where, when a test ran just after one of the repos
had been regenerated, the infra mirror it's supposed to use
would be rejected because the checksum wasn't on the list - but
not because the mirror was stale, but because it was too fresh,
it had got the new packages and metadata but mirrormanager's
list of checksums hadn't been updated to include the checksum
for the latest metadata.
All this baseurl munging code was getting ridiculous, though,
what with the tests getting more complicated and errors showing
up in the actual repo files and stuff. It occurred to me that
instead of using the baseurl we can just use the 'mirrorlist'
system instead of 'metalink'. mirrorlist is the dumber, older
system which just provides the package manager a list of mirrors
and nothing else - the whole stale-mirror-detection-checksum
thing does not happen with mirrorlists, the package manager just
tries all the mirrors in order and uses the first that works.
And happily, it's very easy to convert the metalink URLs into
mirrorlist URLs, and it saves all that faffing around trying to
fix up baseurls.
Also, adjust upgrade_boot to do the s/metalink/mirrorlist/
substitution, so upgrade tests don't run into the timing issue
in the steps before the main repo_setup run is done by
upgrade_run, and adjust repo_setup_compose to sub this line out
later.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-05-09 19:35:59 +00:00
|
|
|
|
2019-01-29 09:06:16 +00:00
|
|
|
# Set up an additional repo containing the update or task packages. We do
|
|
|
|
# this rather than simply running a one-time update because it may be the
|
|
|
|
# case that a package from the update isn't installed *now* but will be
|
|
|
|
# installed by one of the tests; by setting up a repo containing the
|
|
|
|
# update and enabling it here, we ensure all later 'dnf install' calls
|
|
|
|
# will get the packages from the update.
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
assert_script_run "mkdir -p /opt/update_repo";
|
2019-03-13 19:37:42 +00:00
|
|
|
# if NUMDISKS is above 1, assume we want to put the update repo on
|
|
|
|
# the other disk (to avoid huge updates exhausting space on the main
|
|
|
|
# disk)
|
|
|
|
if (get_var("NUMDISKS") > 1) {
|
|
|
|
# I think the disk will always be vdb. This creates a single large
|
|
|
|
# partition.
|
|
|
|
assert_script_run "echo 'type=83' | sfdisk /dev/vdb";
|
|
|
|
assert_script_run "mkfs.ext4 /dev/vdb1";
|
|
|
|
assert_script_run "echo '/dev/vdb1 /opt/update_repo ext4 defaults 1 2' >> /etc/fstab";
|
|
|
|
assert_script_run "mount /opt/update_repo";
|
|
|
|
}
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
assert_script_run "cd /opt/update_repo";
|
2017-09-04 18:05:00 +00:00
|
|
|
assert_script_run "dnf -y install bodhi-client git createrepo koji", 300;
|
2019-06-18 02:12:01 +00:00
|
|
|
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
# download the packages
|
2019-09-20 17:58:27 +00:00
|
|
|
if (get_var("ADVISORY_NVRS")) {
|
2019-01-29 09:06:16 +00:00
|
|
|
# regular update case
|
2019-09-20 17:58:27 +00:00
|
|
|
foreach my $nvr (split(/ /, get_var("ADVISORY_NVRS"))) {
|
|
|
|
assert_script_run "koji download-build --arch=" . get_var("ARCH") . " --arch=noarch $nvr", 600;
|
2019-09-20 18:04:31 +00:00
|
|
|
}
|
2019-01-29 09:06:16 +00:00
|
|
|
}
|
2019-09-20 17:58:27 +00:00
|
|
|
elsif (get_var("KOJITASK")) {
|
2019-01-29 09:06:16 +00:00
|
|
|
# Koji task case (KOJITASK will be set)
|
|
|
|
assert_script_run "koji download-task --arch=" . get_var("ARCH") . " --arch=noarch " . get_var("KOJITASK"), 600;
|
|
|
|
}
|
2019-09-20 17:58:27 +00:00
|
|
|
else {
|
|
|
|
die "Neither ADVISORY_NVRS nor KOJITASK set! Don't know what to do";
|
|
|
|
}
|
2018-05-03 18:28:30 +00:00
|
|
|
|
2017-02-22 20:59:39 +00:00
|
|
|
# log the exact packages in the update at test time, with their
|
2018-09-28 21:21:28 +00:00
|
|
|
# source packages and epochs
|
2017-02-22 20:59:39 +00:00
|
|
|
assert_script_run 'rpm -qp *.rpm --qf "%{SOURCERPM} %{EPOCH} %{NAME}-%{VERSION}-%{RELEASE}\n" | sort -u > /var/log/updatepkgs.txt';
|
2018-09-28 21:21:28 +00:00
|
|
|
upload_logs "/var/log/updatepkgs.txt";
|
Notice when update package should have been installed but wasn't
We hit an interesting case in update testing recently:
https://bodhi.fedoraproject.org/updates/FEDORA-2018-115068f60e
An earlier version of that update failed testing. When we dug
into it a bit, we found that the test was failing because an
earlier version of the `pki-server` package was installed than
the version that was in the update; when asked (as part of
FreeIPA deployment) to install it, dnf had noticed that there
were dependency issues with the version of the package from the
update, but it happened to be able to install the version from
the frozen 'stable' repo...so it just went ahead and did that.
In this case, the 'missed' package resulted in a test failure,
but it'd actually be possible for this to happen and the test
to complete; we really ought to notice when this happens, and
treat it as a test failure.
So what this attempts to do is: at the end of all update tests,
check for all installed packages with the same name as a package
from the update, and compare their full NEVR to the one of the
package from the update. If a package with the same name as one
of the update packages is installed, but does not appear to be
the *same NEVR*, we fail, and upload the lists of packages for
manual investigation as to what the heck's going on.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-12-12 23:43:51 +00:00
|
|
|
# also log just the binary package names: this is so we can check
|
|
|
|
# later whether any package from the update *should* have been
|
|
|
|
# installed, but was not
|
|
|
|
assert_script_run 'rpm -qp *.rpm --qf "%{NAME} " > /var/log/updatepkgnames.txt';
|
|
|
|
upload_logs "/var/log/updatepkgnames.txt";
|
2019-12-06 19:42:43 +00:00
|
|
|
|
2019-12-11 20:02:21 +00:00
|
|
|
# we periodically need to pull an update from updates-testing in
|
|
|
|
# to fix some bug or other. so, here's an organized way to do it.
|
|
|
|
# we do this here so the workaround packages are in the repo data
|
|
|
|
# but *not* in the package lists generated above (those should
|
|
|
|
# only include packages from the update under test). we'll define
|
|
|
|
# a hash of releases and update IDs. if no workarounds are needed
|
|
|
|
# for any release, the hash can be empty and this will do nothing
|
|
|
|
my %workarounds = (
|
2020-02-05 10:51:37 +00:00
|
|
|
"30" => [],
|
2020-02-26 01:40:22 +00:00
|
|
|
"31" => [],
|
|
|
|
"32" => ["FEDORA-2020-755d29d4b0"]
|
2019-12-11 20:02:21 +00:00
|
|
|
);
|
|
|
|
# then we'll download each update for our release:
|
|
|
|
my $advisories = $workarounds{$version};
|
|
|
|
foreach my $advisory (@$advisories) {
|
|
|
|
assert_script_run "bodhi updates download --updateid=$advisory", 180;
|
|
|
|
}
|
|
|
|
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
# create the repo metadata
|
|
|
|
assert_script_run "createrepo .";
|
2019-02-08 16:20:24 +00:00
|
|
|
# write a repo config file, unless this is the support_server test
|
|
|
|
# and it is running on a different release than the update is for
|
|
|
|
# (in this case we need the repo to exist but do not want to use
|
|
|
|
# it on the actual support_server system)
|
2019-12-11 20:02:21 +00:00
|
|
|
unless (get_var("TEST") eq "support_server" && $version ne get_var("CURRREL")) {
|
2019-02-08 16:20:24 +00:00
|
|
|
assert_script_run 'printf "[advisory]\nname=Advisory repo\nbaseurl=file:///opt/update_repo\nenabled=1\nmetadata_expire=3600\ngpgcheck=0" > /etc/yum.repos.d/advisory.repo';
|
|
|
|
# run an update now (except for upgrade tests)
|
2019-03-14 15:38:54 +00:00
|
|
|
script_run "dnf -y update", 900 unless (get_var("UPGRADE"));
|
2019-02-08 16:20:24 +00:00
|
|
|
}
|
2019-01-29 09:06:16 +00:00
|
|
|
# mark via a variable that we've set up the update/task repo and done
|
2018-12-13 02:09:38 +00:00
|
|
|
# all the logging stuff above
|
|
|
|
set_var('_ADVISORY_REPO_DONE', '1');
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub repo_setup {
|
|
|
|
# Run the appropriate sub-function for the job
|
2019-01-29 09:06:16 +00:00
|
|
|
get_var("ADVISORY_OR_TASK") ? _repo_setup_updates : _repo_setup_compose;
|
2017-03-15 17:02:25 +00:00
|
|
|
# This repo does not always exist for Rawhide or Branched, and
|
|
|
|
# some things (at least realmd) try to update the repodata for
|
|
|
|
# it even though it is disabled, and fail. At present none of the
|
|
|
|
# tests needs it, so let's just unconditionally nuke it.
|
|
|
|
assert_script_run "rm -f /etc/yum.repos.d/fedora-cisco-openh264.repo";
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
}
|
|
|
|
|
2017-04-03 23:23:45 +00:00
|
|
|
sub gnome_initial_setup {
|
|
|
|
# Handle gnome-initial-setup, with variations for the pre-login
|
|
|
|
# mode (when no user was created during install) and post-login
|
|
|
|
# mode (when user was created during install)
|
|
|
|
my %args = (
|
|
|
|
prelogin => 0,
|
|
|
|
timeout => 120,
|
|
|
|
@_
|
|
|
|
);
|
2018-03-29 23:48:25 +00:00
|
|
|
my $version = lc(get_var("VERSION"));
|
|
|
|
# the pages we *may* need to click 'next' on. *NOTE*: 'language'
|
|
|
|
# is the 'welcome' page, and is in fact never truly skipped; if
|
|
|
|
# it's configured to be skipped, it just shows without the language
|
|
|
|
# selection widget (so it's a bare 'welcome' page). Current openQA
|
|
|
|
# tests never see 'eula' or 'network'. You can find the upstream
|
|
|
|
# list in gnome-initial-setup/gnome-initial-setup.c , and the skip
|
|
|
|
# config file for Fedora is vendor.conf in the package repo.
|
|
|
|
my @nexts = ('language', 'keyboard', 'privacy', 'timezone', 'software');
|
|
|
|
# now, we're going to figure out how many of them this test will
|
|
|
|
# *actually* see...
|
2017-04-03 23:23:45 +00:00
|
|
|
if ($args{prelogin}) {
|
2018-03-29 23:48:25 +00:00
|
|
|
# 'language', 'keyboard' and 'timezone' are skipped on F28+ in
|
|
|
|
# the 'new user' mode by
|
|
|
|
# https://fedoraproject.org//wiki/Changes/ReduceInitialSetupRedundancy
|
|
|
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1474787 ,
|
2018-04-09 23:50:16 +00:00
|
|
|
# except 'language' is never *really* skipped (see above)
|
2020-01-10 22:20:44 +00:00
|
|
|
@nexts = grep {$_ ne 'keyboard'} @nexts;
|
|
|
|
@nexts = grep {$_ ne 'timezone'} @nexts;
|
2017-04-03 23:23:45 +00:00
|
|
|
}
|
2018-03-29 23:48:25 +00:00
|
|
|
else {
|
|
|
|
# 'timezone' and 'software' are suppressed for the 'existing user'
|
|
|
|
# form of g-i-s
|
|
|
|
@nexts = grep {$_ ne 'software'} @nexts;
|
|
|
|
@nexts = grep {$_ ne 'timezone'} @nexts;
|
|
|
|
}
|
|
|
|
# 'additional software sources' screen does not display on F28+:
|
|
|
|
# https://bugzilla.gnome.org/show_bug.cgi?id=794825
|
2020-01-10 22:20:44 +00:00
|
|
|
@nexts = grep {$_ ne 'software'} @nexts;
|
2018-03-29 23:48:25 +00:00
|
|
|
|
2017-04-03 23:23:45 +00:00
|
|
|
assert_screen "next_button", $args{timeout};
|
|
|
|
# wait a bit in case of animation
|
|
|
|
wait_still_screen 3;
|
2017-09-02 23:16:54 +00:00
|
|
|
# GDM 3.24.1 dumps a cursor in the middle of the screen here...
|
|
|
|
mouse_hide if ($args{prelogin});
|
2018-03-29 23:48:25 +00:00
|
|
|
for my $n (1..scalar(@nexts)) {
|
2017-04-03 23:23:45 +00:00
|
|
|
# click 'Next' $nexts times, moving the mouse to avoid
|
|
|
|
# highlight problems, sleeping to give it time to get
|
|
|
|
# to the next screen between clicks
|
|
|
|
mouse_set(100, 100);
|
|
|
|
wait_screen_change { assert_and_click "next_button"; };
|
|
|
|
# for Japanese, we need to workaround a bug on the keyboard
|
|
|
|
# selection screen
|
|
|
|
if ($n == 1 && get_var("LANGUAGE") eq 'japanese') {
|
|
|
|
if (!check_screen 'initial_setup_kana_kanji_selected', 5) {
|
|
|
|
record_soft_failure 'kana kanji not selected: bgo#776189';
|
|
|
|
assert_and_click 'initial_setup_kana_kanji';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-11-05 20:13:33 +00:00
|
|
|
unless (get_var("VNC_CLIENT")) {
|
|
|
|
# click 'Skip' one time (this is the 'goa' screen). We don't
|
|
|
|
# get it on VNC_CLIENT case as network isn't working (yet)
|
|
|
|
mouse_set(100,100);
|
|
|
|
wait_screen_change { assert_and_click "skip_button"; };
|
|
|
|
}
|
2017-04-03 23:23:45 +00:00
|
|
|
send_key "ret";
|
|
|
|
if ($args{prelogin}) {
|
|
|
|
# create user
|
|
|
|
my $user_login = get_var("USER_LOGIN") || "test";
|
|
|
|
my $user_password = get_var("USER_PASSWORD") || "weakpassword";
|
|
|
|
type_very_safely $user_login;
|
|
|
|
wait_screen_change { assert_and_click "next_button"; };
|
|
|
|
type_very_safely $user_password;
|
|
|
|
send_key "tab";
|
|
|
|
type_very_safely $user_password;
|
|
|
|
wait_screen_change { assert_and_click "next_button"; };
|
|
|
|
send_key "ret";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
# wait for the stupid 'help' screen to show and kill it
|
2018-05-24 21:17:24 +00:00
|
|
|
if (check_screen "getting_started", 30) {
|
2017-11-25 00:36:31 +00:00
|
|
|
send_key "alt-f4";
|
|
|
|
wait_still_screen 5;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
record_soft_failure "'getting started' missing (probably BGO#790811)";
|
|
|
|
}
|
2017-04-03 23:23:45 +00:00
|
|
|
# don't do it again on second load
|
|
|
|
}
|
|
|
|
set_var("_setup_done", 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub _type_user_password {
|
|
|
|
# convenience function used by anaconda_create_user, not meant
|
|
|
|
# for direct use
|
|
|
|
my $user_password = get_var("USER_PASSWORD") || "weakpassword";
|
|
|
|
if (get_var("SWITCHED_LAYOUT")) {
|
|
|
|
# we double the password, the second time using the native
|
|
|
|
# layout, so the password has both ASCII and native characters
|
|
|
|
desktop_switch_layout "ascii", "anaconda";
|
|
|
|
type_very_safely $user_password;
|
|
|
|
desktop_switch_layout "native", "anaconda";
|
|
|
|
type_very_safely $user_password;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
type_very_safely $user_password;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub anaconda_create_user {
|
|
|
|
# Create a user, in the anaconda interface. This is here because
|
|
|
|
# the same code works both during install and for initial-setup,
|
|
|
|
# which runs post-install, so we can share it.
|
|
|
|
my %args = (
|
|
|
|
timeout => 90,
|
|
|
|
@_
|
|
|
|
);
|
|
|
|
my $user_login = get_var("USER_LOGIN") || "test";
|
2020-01-10 22:22:20 +00:00
|
|
|
assert_and_click("anaconda_install_user_creation", timeout=>$args{timeout});
|
2017-04-03 23:23:45 +00:00
|
|
|
assert_screen "anaconda_install_user_creation_screen";
|
|
|
|
# wait out animation
|
|
|
|
wait_still_screen 2;
|
|
|
|
type_very_safely $user_login;
|
|
|
|
type_very_safely "\t\t\t\t";
|
|
|
|
_type_user_password();
|
|
|
|
wait_screen_change { send_key "tab"; };
|
|
|
|
wait_still_screen 2;
|
|
|
|
_type_user_password();
|
|
|
|
# even with all our slow typing this still *sometimes* seems to
|
|
|
|
# miss a character, so let's try again if we have a warning bar.
|
|
|
|
# But not if we're installing with a switched layout, as those
|
|
|
|
# will *always* result in a warning bar at this point (see below)
|
|
|
|
if (!get_var("SWITCHED_LAYOUT") && check_screen "anaconda_warning_bar", 3) {
|
|
|
|
wait_screen_change { send_key "shift-tab"; };
|
|
|
|
wait_still_screen 2;
|
|
|
|
_type_user_password();
|
|
|
|
wait_screen_change { send_key "tab"; };
|
|
|
|
wait_still_screen 2;
|
|
|
|
_type_user_password();
|
|
|
|
}
|
|
|
|
assert_and_click "anaconda_install_user_creation_make_admin";
|
|
|
|
assert_and_click "anaconda_spoke_done";
|
|
|
|
# since 20170105, we will get a warning here when the password
|
|
|
|
# contains non-ASCII characters. Assume only switched layouts
|
|
|
|
# produce non-ASCII characters, though this isn't strictly true
|
|
|
|
if (get_var('SWITCHED_LAYOUT') && check_screen "anaconda_warning_bar", 3) {
|
|
|
|
wait_still_screen 1;
|
|
|
|
assert_and_click "anaconda_spoke_done";
|
|
|
|
}
|
|
|
|
}
|
2017-07-10 18:41:02 +00:00
|
|
|
|
|
|
|
sub check_desktop_clean {
|
|
|
|
# Check we're at a 'clean' desktop. This used to be a simple
|
|
|
|
# needle check, but Rawhide's default desktop is now one which
|
|
|
|
# changes over time, and the GNOME top bar is now translucent
|
|
|
|
# by default; together these changes mean it's impossible to
|
|
|
|
# make a reliable needle, so we need something more tricksy to
|
|
|
|
# cover that case. 'tries' is the amount of check cycles to run
|
|
|
|
# before giving up and failing; each cycle should take ~3 secs.
|
|
|
|
my %args = (
|
|
|
|
tries => 10,
|
|
|
|
@_
|
|
|
|
);
|
|
|
|
foreach my $i (1..$args{tries}) {
|
|
|
|
# we still *do* the needle check, for all cases it covers
|
|
|
|
return if (check_screen "graphical_desktop_clean", 1);
|
|
|
|
# now do the special GNOME case
|
|
|
|
if (get_var("DESKTOP") eq "gnome") {
|
2017-07-10 22:05:36 +00:00
|
|
|
send_key "super";
|
2017-07-10 18:41:02 +00:00
|
|
|
if (check_screen "overview_app_grid", 2) {
|
2017-07-10 22:05:36 +00:00
|
|
|
send_key "super";
|
2017-07-10 18:41:02 +00:00
|
|
|
wait_still_screen 3;
|
|
|
|
# go back to the desktop, if we're still at the app
|
|
|
|
# grid (can be a bit fuzzy depending on response lag)
|
|
|
|
while (check_screen "overview_app_grid", 1) {
|
2017-07-10 22:05:36 +00:00
|
|
|
send_key "super";
|
2017-07-10 18:41:02 +00:00
|
|
|
wait_still_screen 3;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
# to keep the timing equal
|
|
|
|
sleep 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
die "Clean desktop not reached!";
|
|
|
|
}
|
2018-09-26 13:32:42 +00:00
|
|
|
|
|
|
|
sub download_modularity_tests {
|
|
|
|
# Download the modularity test script, place in the system and then
|
|
|
|
# modify the access rights to make it executable.
|
2019-07-17 17:40:03 +00:00
|
|
|
my ($whitelist) = @_;
|
2019-08-08 00:49:12 +00:00
|
|
|
# we need python3-yaml for the script to run
|
|
|
|
assert_script_run 'dnf -y install python3-yaml', 180;
|
2019-08-13 01:18:52 +00:00
|
|
|
assert_script_run 'curl -o /root/test.py https://pagure.io/fedora-qa/modularity_testing_scripts/raw/master/f/modular_functions.py';
|
2019-07-10 08:47:10 +00:00
|
|
|
if ($whitelist eq 'whitelist') {
|
|
|
|
assert_script_run 'curl -o /root/whitelist https://pagure.io/fedora-qa/modularity_testing_scripts/raw/master/f/whitelist';
|
|
|
|
}
|
2018-09-26 13:32:42 +00:00
|
|
|
assert_script_run 'chmod 755 /root/test.py';
|
|
|
|
}
|
2018-10-31 01:23:19 +00:00
|
|
|
|
|
|
|
sub quit_firefox {
|
|
|
|
# Quit Firefox, handling the 'close multiple tabs' warning screen if
|
|
|
|
# it shows up
|
|
|
|
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) {
|
2019-01-02 21:53:31 +00:00
|
|
|
# if we hit the tabs warning, click it
|
2020-01-10 22:41:41 +00:00
|
|
|
click_lastmatch if (match_has_tag "firefox_close_tabs");
|
|
|
|
}
|
|
|
|
# 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...
|
2018-10-31 01:23:19 +00:00
|
|
|
}
|
2018-12-13 02:09:38 +00:00
|
|
|
|
2018-12-18 12:07:37 +00:00
|
|
|
sub start_with_launcher {
|
|
|
|
# Get the name of the needle with a launcher, find the launcher in the menu
|
2019-01-29 14:40:52 +00:00
|
|
|
# and click on it to start the application. This function works for the
|
|
|
|
# Gnome desktop.
|
2018-12-18 12:07:37 +00:00
|
|
|
|
|
|
|
# $launcher holds the launcher needle, but some of the apps are hidden in a submenu
|
|
|
|
# so this must be handled first to find the launcher needle.
|
2019-05-16 13:01:52 +00:00
|
|
|
|
2019-01-29 14:40:52 +00:00
|
|
|
my ($launcher,$submenu,$group) = @_;
|
2018-12-18 12:07:37 +00:00
|
|
|
$submenu //= '';
|
2019-01-29 14:40:52 +00:00
|
|
|
$group //= '';
|
|
|
|
my $desktop = get_var('DESKTOP');
|
2019-05-16 13:01:52 +00:00
|
|
|
|
2019-01-29 14:40:52 +00:00
|
|
|
my $item_to_check = $submenu || $launcher;
|
|
|
|
# The following varies for different desktops.
|
|
|
|
if ($desktop eq 'gnome') {
|
|
|
|
# Start the Activities page
|
|
|
|
send_key 'alt-f1';
|
|
|
|
wait_still_screen 5;
|
2018-12-18 12:07:37 +00:00
|
|
|
|
2019-01-29 14:40:52 +00:00
|
|
|
# Click on the menu icon to come into the menus
|
2019-06-25 21:00:28 +00:00
|
|
|
assert_and_click 'overview_app_grid';
|
2019-01-29 14:40:52 +00:00
|
|
|
wait_still_screen 5;
|
2018-12-18 12:07:37 +00:00
|
|
|
|
2019-05-16 13:01:52 +00:00
|
|
|
# Find the application launcher in the current menu page.
|
2019-01-29 14:40:52 +00:00
|
|
|
# If it cannot be found there, hit PageDown to go to another page.
|
2018-12-18 12:07:37 +00:00
|
|
|
|
2019-01-29 14:40:52 +00:00
|
|
|
send_key_until_needlematch($item_to_check, 'pgdn', 5, 3);
|
2018-12-18 12:07:37 +00:00
|
|
|
|
2019-01-29 14:40:52 +00:00
|
|
|
# If there was a submenu, click on that first.
|
|
|
|
if ($submenu) {
|
|
|
|
assert_and_click $submenu;
|
|
|
|
wait_still_screen 5;
|
|
|
|
}
|
|
|
|
# Click on the launcher
|
|
|
|
assert_and_click $launcher;
|
2018-12-18 12:07:37 +00:00
|
|
|
wait_still_screen 5;
|
|
|
|
}
|
2019-01-29 14:40:52 +00:00
|
|
|
elsif ($desktop eq 'kde'){
|
|
|
|
# Click on the KDE launcher icon
|
|
|
|
assert_and_click 'kde_menu_launcher';
|
|
|
|
wait_still_screen 2;
|
2019-05-16 13:01:52 +00:00
|
|
|
|
|
|
|
# Select the appropriate submenu
|
2019-01-29 14:40:52 +00:00
|
|
|
assert_and_click $submenu;
|
|
|
|
wait_still_screen 2;
|
|
|
|
|
|
|
|
# Select the appropriate menu subgroup where real launchers
|
|
|
|
# are placed, but only if requested
|
|
|
|
if ($group) {
|
2019-05-16 13:01:52 +00:00
|
|
|
send_key_until_needlematch($group, 'down', 20, 3);
|
|
|
|
send_key 'ret';
|
|
|
|
#assert_and_click $group;
|
2019-01-29 14:40:52 +00:00
|
|
|
wait_still_screen 2;
|
|
|
|
}
|
2018-12-18 12:07:37 +00:00
|
|
|
|
2019-01-29 14:40:52 +00:00
|
|
|
# Find and click on the menu item to start the application
|
2019-03-15 14:34:25 +00:00
|
|
|
send_key_until_needlematch($launcher, 'down', 40, 3);
|
|
|
|
send_key 'ret';
|
2019-01-29 14:40:52 +00:00
|
|
|
wait_still_screen 5;
|
2019-05-16 13:01:52 +00:00
|
|
|
}
|
2018-12-18 12:07:37 +00:00
|
|
|
}
|
|
|
|
|
2019-01-29 14:40:52 +00:00
|
|
|
|
2018-12-18 12:07:37 +00:00
|
|
|
sub quit_with_shortcut {
|
|
|
|
# Quit the application using the Alt-F4 keyboard shortcut
|
|
|
|
send_key 'alt-f4';
|
|
|
|
wait_still_screen 5;
|
|
|
|
assert_screen 'workspace';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-07-24 00:10:13 +00:00
|
|
|
sub lo_dismiss_tip {
|
|
|
|
# identify and close a 'tip of the day' window that shows on start
|
|
|
|
# of all LibreOffice apps. For the 'app startup' tests.
|
|
|
|
assert_screen ["libreoffice_tip", "libreoffice_any"];
|
|
|
|
# we use check_screen here just in case both needles match and
|
|
|
|
# libreoffice_any 'won'
|
|
|
|
send_key 'esc' if (check_screen "libreoffice_tip", 2);
|
|
|
|
}
|
|
|
|
|
2018-12-13 02:09:38 +00:00
|
|
|
sub advisory_get_installed_packages {
|
|
|
|
# For update tests (this only works if we've been through
|
|
|
|
# _repo_setup_updates), figure out which packages from the update
|
|
|
|
# are currently installed. This is here so we can do it both in
|
|
|
|
# _advisory_post and post_fail_hook.
|
|
|
|
return unless (get_var("_ADVISORY_REPO_DONE"));
|
|
|
|
assert_script_run 'rpm -qa --qf "%{SOURCERPM} %{EPOCH} %{NAME}-%{VERSION}-%{RELEASE}\n" | sort -u > /tmp/allpkgs.txt';
|
|
|
|
# this finds lines which appear in both files
|
|
|
|
# http://www.unix.com/unix-for-dummies-questions-and-answers/34549-find-matching-lines-between-2-files.html
|
|
|
|
if (script_run 'comm -12 /tmp/allpkgs.txt /var/log/updatepkgs.txt > /var/log/testedpkgs.txt') {
|
|
|
|
# occasionally, for some reason, it's unhappy about sorting;
|
|
|
|
# we shouldn't fail the test in this case, just upload the
|
|
|
|
# files so we can see why...
|
|
|
|
upload_logs "/tmp/allpkgs.txt", failok=>1;
|
|
|
|
upload_logs "/var/log/updatepkgs.txt", failok=>1;
|
|
|
|
}
|
|
|
|
# we'll try and upload the output even if comm 'failed', as it
|
|
|
|
# does in fact still write it in some cases
|
|
|
|
upload_logs "/var/log/testedpkgs.txt", failok=>1;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub advisory_check_nonmatching_packages {
|
|
|
|
# For update tests (this only works if we've been through
|
|
|
|
# _repo_setup_updates), figure out if we have a different version
|
|
|
|
# of any package from the update installed - this indicates a
|
|
|
|
# problem, it likely means a dep issue meant dnf installed an
|
|
|
|
# older version from the frozen release repo
|
|
|
|
my %args = (
|
|
|
|
fatal => 1,
|
|
|
|
@_
|
|
|
|
);
|
|
|
|
return unless (get_var("_ADVISORY_REPO_DONE"));
|
|
|
|
# if this fails in advisory_post, we don't want to do it *again*
|
|
|
|
# unnecessarily in post_fail_hook
|
|
|
|
return if (get_var("_ACNMP_DONE"));
|
|
|
|
script_run 'touch /tmp/installedupdatepkgs.txt';
|
2018-12-14 02:52:51 +00:00
|
|
|
# this creates /tmp/installedupdatepkgs.txt as a sorted list of installed
|
|
|
|
# packages with the same name as packages from the update, in the same form
|
|
|
|
# as /var/log/updatepkgs.txt. The 'tail -1' tries to handle the problem of
|
|
|
|
# installonly packages like the kernel, where we wind up with *multiple*
|
|
|
|
# versions installed after the update; I'm hoping the last line of output
|
|
|
|
# for any given package is the most recent version, i.e. the one in the
|
|
|
|
# update.
|
|
|
|
script_run 'for pkg in $(cat /var/log/updatepkgnames.txt); do rpm -q $pkg && rpm -q $pkg --qf "%{SOURCERPM} %{EPOCH} %{NAME}-%{VERSION}-%{RELEASE}\n" | tail -1 >> /tmp/installedupdatepkgs.txt; done';
|
2018-12-13 02:09:38 +00:00
|
|
|
script_run 'sort -u -o /tmp/installedupdatepkgs.txt /tmp/installedupdatepkgs.txt';
|
2018-12-14 02:52:51 +00:00
|
|
|
# if any line appears in installedupdatepkgs.txt but not updatepkgs.txt,
|
|
|
|
# we have a problem.
|
2018-12-13 02:09:38 +00:00
|
|
|
if (script_run 'comm -23 /tmp/installedupdatepkgs.txt /var/log/updatepkgs.txt > /var/log/installednotupdatedpkgs.txt') {
|
|
|
|
# occasionally, for some reason, it's unhappy about sorting;
|
|
|
|
# we shouldn't fail the test in this case, just upload the
|
|
|
|
# files so we can see why...
|
|
|
|
upload_logs "/tmp/installedupdatepkgs.txt", failok=>1;
|
|
|
|
upload_logs "/var/log/updatepkgs.txt", failok=>1;
|
|
|
|
}
|
|
|
|
# this exits 1 if the file is zero-length, 0 if it's longer
|
|
|
|
# if it's 0, that's *BAD*: we want to upload the file and fail
|
|
|
|
unless (script_run 'test -s /var/log/installednotupdatedpkgs.txt') {
|
|
|
|
upload_logs "/var/log/installednotupdatedpkgs.txt", failok=>1;
|
|
|
|
upload_logs "/var/log/updatepkgs.txt", failok=>1;
|
|
|
|
my $message = "Package(s) from update not installed when it should have been! See installednotupdatedpkgs.txt";
|
|
|
|
if ($args{fatal}) {
|
|
|
|
set_var("_ACNMP_DONE", "1");
|
|
|
|
die $message;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
# if we're already in post_fail_hook, we don't want to die again
|
|
|
|
record_info $message;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-04-10 08:11:38 +00:00
|
|
|
|
|
|
|
sub select_rescue_mode {
|
|
|
|
# handle bootloader screen
|
|
|
|
assert_screen "bootloader", 30;
|
|
|
|
if (get_var('OFW')) {
|
|
|
|
# select "rescue system" directly
|
|
|
|
send_key "down";
|
|
|
|
send_key "down";
|
|
|
|
send_key "ret";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
# select troubleshooting
|
|
|
|
send_key "down";
|
|
|
|
send_key "ret";
|
|
|
|
# select "rescue system"
|
|
|
|
if (get_var('UEFI')) {
|
|
|
|
send_key "down";
|
|
|
|
# we need this on aarch64 till #1661288 is resolved
|
|
|
|
if (get_var('ARCH') eq 'aarch64') {
|
|
|
|
send_key "e";
|
|
|
|
# duped with do_bootloader, sadly...
|
|
|
|
for (1 .. 50) {
|
|
|
|
send_key 'down';
|
|
|
|
}
|
|
|
|
sleep 1;
|
|
|
|
send_key 'up';
|
|
|
|
sleep 1;
|
|
|
|
send_key 'up';
|
|
|
|
send_key "end";
|
|
|
|
type_safely " console=tty0";
|
|
|
|
send_key "ctrl-x";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
send_key "ret";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
type_string "r\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
assert_screen "rescue_select", 120; # it takes time to start anaconda
|
|
|
|
}
|
2019-02-04 14:46:31 +00:00
|
|
|
|
|
|
|
sub copy_devcdrom_as_isofile {
|
|
|
|
# copy /dev/cdrom as iso file and verify checksum is same
|
|
|
|
# as cdrom previously retrieved from ISO_URL
|
|
|
|
my $isoname = shift;
|
|
|
|
assert_script_run "dd if=/dev/cdrom of=$isoname", 360;
|
|
|
|
# verify iso checksum
|
|
|
|
my $cdurl = get_var('ISO_URL');
|
2019-08-16 02:05:59 +00:00
|
|
|
# ISO_URL may not be set if we POSTed manually or something; just assume
|
|
|
|
# we're OK in that case
|
|
|
|
return unless $cdurl;
|
2019-02-04 14:46:31 +00:00
|
|
|
my $cmd = <<EOF;
|
|
|
|
urld="$cdurl"; urld=\${urld%/*}; chkf=\$(curl -fs \$urld/ |grep CHECKSUM | sed -E 's/.*href=.//; s/\".*//') && curl -f \$urld/\$chkf -o /tmp/x
|
|
|
|
chkref=\$(grep -E 'SHA256.*dvd' /tmp/x | sed -e 's/.*= //') && echo "\$chkref $isoname" >/tmp/x
|
|
|
|
sha256sum -c /tmp/x
|
|
|
|
EOF
|
|
|
|
assert_script_run($_) foreach (split /\n/, $cmd);
|
|
|
|
}
|
2019-03-21 09:22:35 +00:00
|
|
|
|
|
|
|
sub bypass_1691487 {
|
|
|
|
if (script_run 'echo "expected command supposed to be typed without error."') {
|
|
|
|
record_soft_failure 'brc#1691487 bypass';
|
|
|
|
script_run 'echo "trial bypass dup chars brc#1691487"';
|
|
|
|
}
|
|
|
|
}
|
2019-05-22 22:18:08 +00:00
|
|
|
|
|
|
|
sub get_release_number {
|
|
|
|
# return the release number; so usually VERSION, but for Rawhide,
|
|
|
|
# we return RAWREL. This allows us to avoid constantly doing stuff
|
|
|
|
# like `if ($version eq "Rawhide" || $version > 30)`.
|
|
|
|
my $version = get_var("VERSION");
|
|
|
|
my $rawrel = get_var("RAWREL", "Rawhide");
|
|
|
|
return $rawrel if ($version eq "Rawhide");
|
|
|
|
return $version
|
2019-08-15 19:00:26 +00:00
|
|
|
}
|
2019-05-16 13:01:52 +00:00
|
|
|
|
|
|
|
sub tell_source {
|
|
|
|
# This helper function identifies the Subvariant of the tested system.
|
|
|
|
# For the purposes of identification testing, we are only interested
|
|
|
|
# if the system is Workstation, Server, or something else, because,
|
|
|
|
# except Workstation and Server, there are no graphical differences
|
|
|
|
# between various spins and isos.
|
|
|
|
my $iso = get_var('SUBVARIANT');
|
|
|
|
if ($iso eq 'Workstation' or $iso eq 'Server') {
|
|
|
|
$iso = lc($iso);
|
|
|
|
}
|
|
|
|
elsif ($iso eq 'AtomicHost') {
|
|
|
|
$iso = 'atomic';
|
|
|
|
}
|
2019-08-21 07:01:47 +00:00
|
|
|
elsif ($iso eq 'Silverblue') {
|
|
|
|
$iso = 'workstation';
|
|
|
|
}
|
2019-05-16 13:01:52 +00:00
|
|
|
else {
|
|
|
|
$iso = 'generic';
|
|
|
|
}
|
|
|
|
return $iso;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub check_left_bar {
|
|
|
|
# This method is used by identification tests to check whether the Anaconda
|
|
|
|
# bar on the left side of the screen corresponds with the correct version.
|
|
|
|
# It looks different for Server, Workstation and others.
|
|
|
|
my $source = tell_source;
|
|
|
|
assert_screen "leftbar_${source}";
|
|
|
|
}
|
|
|
|
|
|
|
|
sub check_top_bar {
|
|
|
|
# This method is used by identification tests to check whether the
|
|
|
|
# top bar in Anaconda corresponds with the correct version of the spin.
|
|
|
|
my $source = tell_source;
|
|
|
|
assert_screen "topbar_${source}";
|
|
|
|
}
|
|
|
|
|
|
|
|
sub check_prerelease {
|
|
|
|
# This method is used by identification tests to check if
|
|
|
|
# Anaconda shows the PRERELEASE info for Rawhide versions.
|
|
|
|
# As it seems, the rules for showing the PRERELEASE are not
|
|
|
|
# as simple as it may look like. It seems to me, that the PRERELEASE
|
|
|
|
# is shown on Rawhide intallations, which is pretty easy to test because
|
|
|
|
# the "VERSION" variable is Rawhide. On Final RC, the PRERELEASE should
|
|
|
|
# be turned off, while it should be present between before that.
|
|
|
|
# When Fedora is branched, the "VERSION" changes to the version number
|
|
|
|
# and this is not changed even with Final, so we cannot test that.
|
|
|
|
# Investigating the history, I noticed that all nightly builds have
|
|
|
|
# that prerelease turned on. And also, it is there on a Beta candidate.
|
2019-08-27 15:36:40 +00:00
|
|
|
# We can test for that. For update tests, if DEVELOPMENT is set the
|
|
|
|
# prerelease tags should appear, otherwise they should not.
|
2019-05-16 13:01:52 +00:00
|
|
|
|
|
|
|
my $beta = get_var('ISO');
|
2019-09-11 21:31:54 +00:00
|
|
|
# install_pxeboot tests have ISO blanked, so we must use ISO_URL
|
2019-09-20 05:15:21 +00:00
|
|
|
$beta ||= get_var('ISO_URL');
|
2019-05-16 13:01:52 +00:00
|
|
|
my $nightly = get_var('BUILD');
|
|
|
|
my $version = get_var('VERSION');
|
2019-08-27 15:36:40 +00:00
|
|
|
my $development = get_var('DEVELOPMENT');
|
2019-05-16 13:01:52 +00:00
|
|
|
# Let us see if the installed system is one that needs to have the prerelease
|
|
|
|
# note shown, default is NO.
|
|
|
|
my $prerelease = 0;
|
2019-08-27 15:36:40 +00:00
|
|
|
if ($beta =~ /Beta/ or $version eq "Rawhide" or $development) {
|
2019-05-16 13:01:52 +00:00
|
|
|
$prerelease = 1;
|
|
|
|
}
|
|
|
|
# If the image is a nightly build or test build, it is not clear whether
|
|
|
|
# the prerelease should be there or not, but according to what we decided
|
|
|
|
# this is not a big issue. This piece of code can be used later, when
|
|
|
|
# we decide differently.
|
|
|
|
elsif ($nightly =~ /\.[nt]\.\d+/) {
|
2019-08-21 06:42:01 +00:00
|
|
|
$prerelease = 10;
|
2019-05-16 13:01:52 +00:00
|
|
|
}
|
|
|
|
# For all prerelease requiring ISOs, assert that prerelease is there.
|
|
|
|
if ($prerelease == 1) {
|
|
|
|
assert_screen "prerelease_note";
|
|
|
|
}
|
|
|
|
elsif ($prerelease == 0) {
|
|
|
|
# If the prerelease note is shown, where it should not be, die!
|
|
|
|
if (check_screen "prerelease_note") {
|
|
|
|
die "The PRERELEASE tag is shown, but it should NOT be.";
|
|
|
|
}
|
|
|
|
}
|
2019-05-22 22:18:08 +00:00
|
|
|
}
|
2019-05-28 16:41:33 +00:00
|
|
|
|
2019-05-16 13:01:52 +00:00
|
|
|
sub check_version {
|
|
|
|
# This function checks if the correct version is display during installation
|
|
|
|
# in Anaconda, i.e. nonlive media showing Rawhide when Rawhide and version numbers
|
|
|
|
# when not Rawhide, while live media always showing version numbers.
|
|
|
|
|
|
|
|
my $version = lc(get_var('VERSION'));
|
|
|
|
if ($version eq 'rawhide' && get_var('LIVE')) {
|
|
|
|
$version = get_var('RAWREL');
|
|
|
|
}
|
|
|
|
assert_screen "version_${version}_ident";
|
|
|
|
}
|
|
|
|
|
|
|
|
sub spell_version_number {
|
|
|
|
my $version = shift;
|
2019-08-21 19:15:59 +00:00
|
|
|
# spelt version of Rawhide is...Rawhide
|
|
|
|
return "Rawhide" if ($version eq 'Rawhide');
|
2019-05-16 13:01:52 +00:00
|
|
|
my %ones = (
|
|
|
|
"0" => "Zero",
|
|
|
|
"1" => "One",
|
|
|
|
"2" => "Two",
|
|
|
|
"3" => "Three",
|
|
|
|
"4" => "Four",
|
|
|
|
"5" => "Five",
|
|
|
|
"6" => "Six",
|
|
|
|
"7" => "Seven",
|
|
|
|
"8" => "Eight",
|
|
|
|
"9" => "Nine",
|
|
|
|
);
|
|
|
|
my %tens = (
|
|
|
|
"2" => "Twenty",
|
|
|
|
"3" => "Thirty",
|
|
|
|
"4" => "Fourty",
|
|
|
|
"5" => "Fifty",
|
|
|
|
"6" => "Sixty",
|
|
|
|
"7" => "Seventy",
|
|
|
|
"8" => "Eighty",
|
|
|
|
"9" => "Ninety",
|
|
|
|
);
|
|
|
|
|
|
|
|
my $ten = substr($version, 0, 1);
|
|
|
|
my $one = substr($version, 1, 1);
|
|
|
|
my $speltnum = "";
|
|
|
|
if ($one eq "0") {
|
|
|
|
$speltnum = "$tens{$ten}";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$speltnum = "$tens{$ten} $ones{$one}";
|
|
|
|
}
|
|
|
|
return $speltnum;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub rec_log {
|
2019-08-21 19:15:59 +00:00
|
|
|
my ($line, $condition, $failref, $filename) = @_;
|
|
|
|
$filename ||= '/tmp/os-release.log';
|
2019-05-16 13:01:52 +00:00
|
|
|
if ($condition) {
|
|
|
|
$line = "${line} - SUCCEEDED\n";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
push @$failref, $line;
|
|
|
|
$line = "${line} - FAILED\n";
|
|
|
|
}
|
2019-08-21 19:15:59 +00:00
|
|
|
script_run "echo \"$line\" >> $filename";
|
2019-05-16 13:01:52 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-07-17 16:02:24 +00:00
|
|
|
sub click_unwanted_notifications {
|
|
|
|
# there are a few KDE tests where at some point we want to click
|
|
|
|
# on all visible 'update available' notifications (there can be
|
|
|
|
# more than one, thanks to
|
|
|
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1730482 ) and the
|
2019-10-30 16:02:20 +00:00
|
|
|
# buggy 'akonadi_migration_agent_running' popup if it's showing -
|
2019-07-17 16:02:24 +00:00
|
|
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1716005
|
|
|
|
# Returns an array indicating which notifications it closed
|
|
|
|
wait_still_screen 5;
|
|
|
|
my $count = 10;
|
|
|
|
my @closed;
|
|
|
|
while ($count > 0 && check_screen "desktop_update_notification_popup", 5) {
|
|
|
|
$count -= 1;
|
|
|
|
push (@closed, 'update');
|
2019-10-30 16:02:20 +00:00
|
|
|
click_lastmatch;
|
2019-07-17 16:02:24 +00:00
|
|
|
}
|
2019-10-30 16:02:20 +00:00
|
|
|
if (check_screen "akonadi_migration_agent_running", 5) {
|
|
|
|
click_lastmatch;
|
2019-07-17 16:02:24 +00:00
|
|
|
push (@closed, 'akonadi');
|
|
|
|
}
|
|
|
|
return @closed;
|
|
|
|
}
|
2019-09-19 14:03:50 +00:00
|
|
|
|
|
|
|
# In each application test, when the application is started successfully, it
|
|
|
|
# will register to the list of applications.
|
|
|
|
sub register_application {
|
|
|
|
my $application = shift;
|
|
|
|
push(@application_list, $application);
|
|
|
|
print("APPLICATION REGISTERED: $application \n");
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|