2015-08-05 06:23:59 +00:00
|
|
|
use base "anacondatest";
|
2015-01-22 12:38:16 +00:00
|
|
|
use strict;
|
|
|
|
use testapi;
|
2017-01-18 07:15:44 +00:00
|
|
|
use utils;
|
2016-09-12 17:24:30 +00:00
|
|
|
|
2019-03-22 12:20:40 +00:00
|
|
|
|
2019-07-23 19:09:16 +00:00
|
|
|
sub _set_root_password {
|
2018-03-09 04:31:14 +00:00
|
|
|
# Set root password, unless we don't want to or can't
|
2018-09-29 00:46:36 +00:00
|
|
|
# can also hit a transition animation
|
|
|
|
wait_still_screen 2;
|
2015-02-13 15:36:35 +00:00
|
|
|
my $root_password = get_var("ROOT_PASSWORD") || "weakpassword";
|
2018-03-09 04:31:14 +00:00
|
|
|
unless (get_var("INSTALLER_NO_ROOT")) {
|
2018-03-09 02:25:31 +00:00
|
|
|
assert_and_click "anaconda_install_root_password";
|
2022-12-13 19:57:00 +00:00
|
|
|
# we have to click 'enable root account' before typing the
|
|
|
|
#password
|
2021-08-24 20:11:15 +00:00
|
|
|
assert_and_click "anaconda_install_root_password_screen";
|
2018-03-09 02:25:31 +00:00
|
|
|
# wait out animation
|
|
|
|
wait_still_screen 2;
|
|
|
|
desktop_switch_layout("ascii", "anaconda") if (get_var("SWITCHED_LAYOUT"));
|
2021-08-24 20:00:23 +00:00
|
|
|
# these screens seems insanely subject to typing errors, so
|
|
|
|
# type super safely. This doesn't really slow the test down
|
|
|
|
# as we still get done before the install process is complete.
|
|
|
|
type_very_safely $root_password;
|
|
|
|
wait_screen_change { send_key "tab"; };
|
|
|
|
type_very_safely $root_password;
|
2019-05-16 13:01:52 +00:00
|
|
|
# Another screen to test identification on
|
|
|
|
my $identification = get_var('IDENTIFICATION');
|
|
|
|
if ($identification eq 'true') {
|
|
|
|
check_top_bar();
|
2019-10-16 18:08:24 +00:00
|
|
|
# we don't check version or pre-release because here those
|
|
|
|
# texts appear on the banner which makes the needling
|
|
|
|
# complex and fragile (banner is different between variants,
|
|
|
|
# and has a gradient so for RTL languages the background color
|
|
|
|
# differs; pre-release text is also translated)
|
2019-05-16 13:01:52 +00:00
|
|
|
}
|
2018-03-09 02:25:31 +00:00
|
|
|
assert_and_click "anaconda_spoke_done";
|
2022-03-22 15:27:56 +00:00
|
|
|
# exiting this screen can take a while, so check for the hub
|
2022-03-24 16:01:22 +00:00
|
|
|
assert_screen "anaconda_main_hub", 60;
|
type root password faster on ostree installs
Summary:
Since we started using `type_very_safely` for typing the root
password, we starting hitting a race issue. If we complete the
root password spoke so slowly that the software deployment
process completes in the meantime, anaconda will wait until we
complete the spoke then immediately flip to the 'post-install
configuration' step, at which point access to the USER CREATION
spoke is blocked.
We don't hit this case on regular RPM installs or live installs
as the deployment phase still takes a while for both of those,
but we are sometimes hitting it for the Atomic ostree install
image, as the software deployment phase is pretty fast there.
We *could* just not bother creating a user and testing we can
log in as a user for that test, but I don't like that approach,
we *should* be testing that user creation and login works OK
for ostree installs. So instead, let's just type the root
password a bit less safely for ostree installs; this will be
more vulnerable to typing errors but hopefully will avoid the
race problem.
Test Plan:
Run a few Atomic installs, see if they hit the race.
Might need to run other tests at the same time, and you may not
be able to hit it, this is obviously dependent on the I/O of
the worker host...
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1022
2016-10-14 01:39:33 +00:00
|
|
|
}
|
2019-07-23 19:09:16 +00:00
|
|
|
}
|
2015-01-22 12:38:16 +00:00
|
|
|
|
2019-07-23 19:09:16 +00:00
|
|
|
sub _do_root_and_user {
|
|
|
|
_set_root_password();
|
2018-03-09 02:25:31 +00:00
|
|
|
# Set user details, unless the test is configured not to create one
|
2020-06-16 15:36:01 +00:00
|
|
|
unless (get_var("USER_LOGIN") eq 'false' || get_var("INSTALL_NO_USER")) {
|
|
|
|
# Wait out animation
|
|
|
|
wait_still_screen 8;
|
|
|
|
anaconda_create_user();
|
|
|
|
}
|
2015-09-29 22:52:50 +00:00
|
|
|
# Check username (and hence keyboard layout) if non-English
|
|
|
|
if (get_var('LANGUAGE')) {
|
|
|
|
assert_screen "anaconda_install_user_created";
|
|
|
|
}
|
2019-07-23 19:09:16 +00:00
|
|
|
}
|
2015-09-29 22:52:50 +00:00
|
|
|
|
2019-07-23 19:09:16 +00:00
|
|
|
sub run {
|
|
|
|
my $self = shift;
|
|
|
|
# From F31 onwards (after Fedora-Rawhide-20190722.n.1), user and
|
|
|
|
# root password spokes are moved to main hub, so we must do those
|
|
|
|
# before we run the install.
|
2021-08-09 22:09:15 +00:00
|
|
|
_do_root_and_user();
|
2019-07-23 19:09:16 +00:00
|
|
|
# Begin installation
|
|
|
|
# Sometimes, the 'slide in from the top' animation messes with
|
|
|
|
# this - by the time we click the button isn't where it was any
|
|
|
|
# more. So wait for screen to stop moving before we click.
|
2021-08-10 18:56:56 +00:00
|
|
|
assert_screen "anaconda_main_hub_begin_installation", 90;
|
|
|
|
wait_still_screen 5;
|
2019-07-23 19:09:16 +00:00
|
|
|
assert_and_click "anaconda_main_hub_begin_installation";
|
2019-05-16 13:01:52 +00:00
|
|
|
|
|
|
|
# If we want to test identification we will do it
|
|
|
|
# on several places in this procedure, such as
|
|
|
|
# on this screen and also on password creation screens
|
|
|
|
# etc.
|
|
|
|
my $identification = get_var('IDENTIFICATION');
|
|
|
|
my $branched = get_var('VERSION');
|
2023-06-19 14:01:39 +00:00
|
|
|
if ($identification eq 'true' or ($branched ne "Rawhide" && $branched ne "ELN")) {
|
2019-05-16 13:01:52 +00:00
|
|
|
check_left_bar();
|
|
|
|
check_prerelease();
|
|
|
|
check_version();
|
|
|
|
}
|
|
|
|
|
2015-11-11 16:48:46 +00:00
|
|
|
# Wait for install to end. Give Rawhide a bit longer, in case
|
|
|
|
# we're on a debug kernel, debug kernel installs are really slow.
|
2022-10-31 14:45:19 +00:00
|
|
|
my $timeout = 3000;
|
2019-04-13 15:02:52 +00:00
|
|
|
my $version = lc(get_var('VERSION'));
|
|
|
|
if ($version eq "rawhide") {
|
2022-10-31 14:45:19 +00:00
|
|
|
$timeout = 4200;
|
2015-11-11 16:48:46 +00:00
|
|
|
}
|
2018-03-09 05:21:23 +00:00
|
|
|
# workstation especially has an unfortunate habit of kicking in
|
|
|
|
# the screensaver during install...
|
|
|
|
my $interval = 60;
|
|
|
|
while ($timeout > 0) {
|
2023-05-16 22:40:02 +00:00
|
|
|
die "Error encountered!" if (check_screen "anaconda_error_report");
|
2018-03-09 05:21:23 +00:00
|
|
|
# move the mouse a bit
|
|
|
|
mouse_set 100, 100;
|
2020-11-18 23:36:12 +00:00
|
|
|
# also click, if we're a VNC client, seems just moving mouse
|
|
|
|
# isn't enough to defeat blanking
|
|
|
|
mouse_click if (get_var("VNC_CLIENT"));
|
2018-03-09 05:21:23 +00:00
|
|
|
mouse_hide;
|
|
|
|
last if (check_screen "anaconda_install_done", $interval);
|
|
|
|
$timeout -= $interval;
|
|
|
|
}
|
2018-06-18 17:59:38 +00:00
|
|
|
assert_screen "anaconda_install_done";
|
2016-05-06 20:15:13 +00:00
|
|
|
# wait for transition to complete so we don't click in the sidebar
|
|
|
|
wait_still_screen 3;
|
2019-06-28 18:41:54 +00:00
|
|
|
# if this is a live install, let's go ahead and quit the installer
|
|
|
|
# in all cases, just to make sure quitting doesn't crash etc.
|
|
|
|
assert_and_click "anaconda_install_done" if (get_var('LIVE'));
|
|
|
|
# there are various things we might have to do at a console here
|
|
|
|
# before we actually reboot. let's figure them all out first...
|
|
|
|
my @actions;
|
2022-07-28 20:32:57 +00:00
|
|
|
push(@actions, 'consoletty0') if (get_var("ARCH") eq "aarch64");
|
|
|
|
push(@actions, 'abrt') if (get_var("ABRT", '') eq "system");
|
|
|
|
push(@actions, 'rootpw') if (get_var("INSTALLER_NO_ROOT"));
|
2021-10-27 17:49:46 +00:00
|
|
|
# FIXME: remove plymouth from Server install_default_upload on
|
|
|
|
# non-aarch64 to work around RHBZ #1933378
|
|
|
|
unless (get_var("ARCH") eq "aarch64") {
|
|
|
|
if (get_var("FLAVOR") eq "Server-dvd-iso" && get_var("TEST") eq "install_default_upload") {
|
2022-07-28 20:32:57 +00:00
|
|
|
push(@actions, 'noplymouth');
|
2021-10-27 17:49:46 +00:00
|
|
|
}
|
|
|
|
}
|
2020-04-02 07:53:29 +00:00
|
|
|
# memcheck test doesn't need to reboot at all. Rebooting from GUI
|
|
|
|
# for lives is unreliable. And if we're already doing something
|
|
|
|
# else at a console, we may as well reboot from there too
|
2022-07-28 20:32:57 +00:00
|
|
|
push(@actions, 'reboot') if (!get_var("MEMCHECK") && (get_var("LIVE") || @actions));
|
2019-11-21 02:56:06 +00:00
|
|
|
# our approach for taking all these actions doesn't work on VNC
|
|
|
|
# installs, fortunately we don't need any of them in that case
|
|
|
|
# yet, so for now let's just flush the list here if we're VNC
|
|
|
|
@actions = () if (get_var("VNC_CLIENT"));
|
2019-06-28 18:41:54 +00:00
|
|
|
# If we have no actions, let's just go ahead and reboot now,
|
|
|
|
# unless this is memcheck
|
|
|
|
unless (@actions) {
|
|
|
|
unless (get_var("MEMCHECK")) {
|
|
|
|
assert_and_click "anaconda_install_done";
|
|
|
|
}
|
|
|
|
return undef;
|
|
|
|
}
|
|
|
|
# OK, if we're here, we got actions, so head to a console. Switch
|
|
|
|
# to console after liveinst sometimes takes a while, so 30 secs
|
2022-07-28 20:32:57 +00:00
|
|
|
$self->root_console(timeout => 30);
|
2020-02-13 19:50:32 +00:00
|
|
|
# this is something a couple of actions may need to know
|
|
|
|
my $mount = "/mnt/sysimage";
|
|
|
|
if (get_var("CANNED")) {
|
|
|
|
# finding the actual host system root is fun for ostree...
|
|
|
|
$mount = "/mnt/sysimage/ostree/deploy/fedora*/deploy/*.?";
|
|
|
|
}
|
2022-07-28 20:32:57 +00:00
|
|
|
if (grep { $_ eq 'consoletty0' } @actions) {
|
2019-03-29 22:18:17 +00:00
|
|
|
# somehow, by this point, localized keyboard layout has been
|
|
|
|
# loaded for this tty, so for French and Arabic at least we
|
|
|
|
# need to load the 'us' layout again for the next command to
|
|
|
|
# be typed correctly
|
|
|
|
console_loadkeys_us;
|
2019-06-28 18:41:54 +00:00
|
|
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1661288 results
|
|
|
|
# in boot messages going to serial console on aarch64, we need
|
|
|
|
# them on tty0. We also need 'quiet' so we don't get kernel
|
|
|
|
# messages, which screw up some needles
|
2020-02-13 19:50:32 +00:00
|
|
|
assert_script_run 'sed -i -e "s,\(GRUB_CMDLINE_LINUX.*\)\",\1 console=tty0 quiet\",g" ' . $mount . '/etc/default/grub';
|
2019-03-29 22:18:17 +00:00
|
|
|
# regenerate the bootloader config
|
2020-02-13 19:50:32 +00:00
|
|
|
assert_script_run "chroot $mount grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg";
|
2019-03-29 22:18:17 +00:00
|
|
|
}
|
2022-07-28 20:32:57 +00:00
|
|
|
if (grep { $_ eq 'abrt' } @actions) {
|
|
|
|
# Chroot in the newly installed system and switch on ABRT systemwide
|
|
|
|
assert_script_run "chroot $mount abrt-auto-reporting 1";
|
2019-06-28 18:41:54 +00:00
|
|
|
}
|
2022-07-28 20:32:57 +00:00
|
|
|
if (grep { $_ eq 'rootpw' } @actions) {
|
2019-07-23 19:09:16 +00:00
|
|
|
my $root_password = get_var("ROOT_PASSWORD") || "weakpassword";
|
2019-06-28 19:53:33 +00:00
|
|
|
assert_script_run "echo 'root:$root_password' | chpasswd -R $mount";
|
2015-03-18 21:28:03 +00:00
|
|
|
}
|
2022-07-28 20:32:57 +00:00
|
|
|
if (grep { $_ eq 'noplymouth' } @actions) {
|
2021-10-27 17:49:46 +00:00
|
|
|
assert_script_run "chroot $mount dnf -y remove plymouth";
|
|
|
|
}
|
2022-07-28 20:32:57 +00:00
|
|
|
type_string "reboot\n" if (grep { $_ eq 'reboot' } @actions);
|
2015-01-22 12:38:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub test_flags {
|
2022-07-28 20:32:57 +00:00
|
|
|
return {fatal => 1};
|
2015-01-22 12:38:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|
|
|
|
|
|
|
|
# vim: set sw=4 et:
|