2016-09-07 08:34:54 +00:00
|
|
|
use base "anacondatest";
|
|
|
|
use strict;
|
|
|
|
use testapi;
|
2017-01-18 07:15:44 +00:00
|
|
|
use utils;
|
2021-04-27 11:02:53 +00:00
|
|
|
use anaconda;
|
2016-09-07 08:34:54 +00:00
|
|
|
|
2019-11-06 12:55:27 +00:00
|
|
|
|
|
|
|
# this enables you to send a command and some post-command wait time
|
|
|
|
# in one step and also distinguishes between serial console and normal
|
|
|
|
# VNC based console and handles the wait times differently.
|
|
|
|
sub console_type_wait {
|
|
|
|
my ($string, $wait) = @_;
|
|
|
|
$wait ||= 5;
|
|
|
|
type_string $string;
|
|
|
|
if (testapi::is_serial_terminal) {
|
|
|
|
sleep $wait;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
wait_still_screen $wait;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-07 08:34:54 +00:00
|
|
|
sub run {
|
|
|
|
my $self = shift;
|
2019-11-06 12:55:27 +00:00
|
|
|
|
|
|
|
# First, preset the environment according to the chosen console. This test
|
|
|
|
# can run both on a VNC based console, or a serial console.
|
|
|
|
if (get_var("SERIAL_CONSOLE")) {
|
2023-05-02 00:07:06 +00:00
|
|
|
select_console('user-virtio-console');
|
2019-11-06 12:55:27 +00:00
|
|
|
unless (testapi::is_serial_terminal) {
|
|
|
|
die "The test does not run on a serial console when it should.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
assert_screen "anaconda_main_hub_text";
|
|
|
|
# IMHO it's better to use sleeps than to have needle for every text screen
|
|
|
|
wait_still_screen 5;
|
|
|
|
}
|
2016-09-07 08:34:54 +00:00
|
|
|
|
|
|
|
# prepare for different number of spokes (e. g. as in Atomic DVD)
|
|
|
|
my %spoke_number = (
|
|
|
|
"language" => 1,
|
|
|
|
"timezone" => 2,
|
|
|
|
"source" => 3,
|
|
|
|
"swselection" => 4,
|
|
|
|
"destination" => 5,
|
|
|
|
"network" => 6,
|
|
|
|
"rootpwd" => 7,
|
|
|
|
"user" => 8
|
|
|
|
);
|
|
|
|
|
2019-11-06 12:55:27 +00:00
|
|
|
# The error message that we are going to check for in the text installation
|
|
|
|
# must be different for serial console and a VNC terminal emulator.
|
|
|
|
my $error = "";
|
|
|
|
if (testapi::is_serial_terminal) {
|
|
|
|
$error = "unknown error has occured";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$error = "anaconda_text_error";
|
|
|
|
}
|
|
|
|
|
2016-09-07 08:34:54 +00:00
|
|
|
# Set timezone
|
2022-07-28 20:32:57 +00:00
|
|
|
run_with_error_check(sub { console_type_wait($spoke_number{"timezone"} . "\n") }, $error);
|
|
|
|
console_type_wait("1\n"); # Set timezone
|
|
|
|
console_type_wait("1\n"); # Europe
|
|
|
|
console_type_wait("37\n", 7); # Prague
|
2016-09-07 08:34:54 +00:00
|
|
|
|
|
|
|
# Select disk
|
2022-07-28 20:32:57 +00:00
|
|
|
run_with_error_check(sub { console_type_wait($spoke_number{"destination"} . "\n") }, $error);
|
|
|
|
console_type_wait("c\n"); # first disk selected, continue
|
|
|
|
console_type_wait("c\n"); # use all space selected, continue
|
|
|
|
console_type_wait("c\n", 7); # LVM selected, continue
|
2016-09-07 08:34:54 +00:00
|
|
|
|
|
|
|
# Set root password
|
2019-11-06 12:55:27 +00:00
|
|
|
my $rootpwd = get_var("ROOT_PASSWORD", "weakpassword");
|
2022-07-28 20:32:57 +00:00
|
|
|
run_with_error_check(sub { console_type_wait($spoke_number{"rootpwd"} . "\n") }, $error);
|
2019-11-06 12:55:27 +00:00
|
|
|
console_type_wait("$rootpwd\n");
|
|
|
|
console_type_wait("$rootpwd\n");
|
2016-09-07 08:34:54 +00:00
|
|
|
|
|
|
|
# Create user
|
2019-11-06 12:55:27 +00:00
|
|
|
my $userpwd = get_var("USER_PASSWORD", "weakpassword");
|
|
|
|
my $username = get_var("USER_LOGIN", "test");
|
2022-07-28 20:32:57 +00:00
|
|
|
run_with_error_check(sub { console_type_wait($spoke_number{"user"} . "\n") }, $error);
|
|
|
|
console_type_wait("1\n"); # create new
|
|
|
|
console_type_wait("3\n"); # set username
|
2019-11-06 12:55:27 +00:00
|
|
|
console_type_wait("$username\n");
|
2022-07-28 20:32:57 +00:00
|
|
|
console_type_wait("5\n"); # set password
|
2019-11-06 12:55:27 +00:00
|
|
|
console_type_wait("$userpwd\n");
|
|
|
|
console_type_wait("$userpwd\n");
|
2022-07-28 20:32:57 +00:00
|
|
|
console_type_wait("6\n"); # make him an administrator
|
2019-11-06 12:55:27 +00:00
|
|
|
console_type_wait("c\n", 7);
|
2016-09-07 08:34:54 +00:00
|
|
|
|
|
|
|
my $counter = 0;
|
2019-11-06 12:55:27 +00:00
|
|
|
if (testapi::is_serial_terminal) {
|
2022-07-28 20:32:57 +00:00
|
|
|
while (wait_serial("[!]", timeout => 5, quiet => 1)) {
|
2019-11-06 12:55:27 +00:00
|
|
|
if ($counter > 10) {
|
|
|
|
die "There are unfinished spokes in Anaconda";
|
|
|
|
}
|
|
|
|
sleep 10;
|
|
|
|
$counter++;
|
2022-07-28 20:32:57 +00:00
|
|
|
console_type_wait("r\n"); # refresh
|
2019-11-06 12:55:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
while (check_screen "anaconda_main_hub_text_unfinished", 2) {
|
|
|
|
if ($counter > 10) {
|
|
|
|
die "There are unfinished spokes in Anaconda";
|
|
|
|
}
|
|
|
|
sleep 10;
|
|
|
|
$counter++;
|
2022-07-28 20:32:57 +00:00
|
|
|
console_type_wait("r\n"); # refresh
|
2016-09-07 08:34:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# begin installation
|
2019-11-06 12:55:27 +00:00
|
|
|
console_type_wait("b\n");
|
2016-09-07 08:34:54 +00:00
|
|
|
|
2022-07-28 20:32:57 +00:00
|
|
|
# When simulated crash is planned, then proceed with the crash routines and finish,
|
2021-04-27 11:02:53 +00:00
|
|
|
# otherwise proceed normally and do
|
|
|
|
if (get_var("CRASH_REPORT")) {
|
|
|
|
crash_anaconda_text;
|
|
|
|
report_bug_text;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-09-07 08:34:54 +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.
|
|
|
|
my $timeout = 1800;
|
|
|
|
if (lc(get_var('VERSION')) eq "rawhide") {
|
|
|
|
$timeout = 2400;
|
|
|
|
}
|
2019-11-06 12:55:27 +00:00
|
|
|
|
|
|
|
if (testapi::is_serial_terminal) {
|
2022-07-28 20:32:57 +00:00
|
|
|
wait_serial("Installation complete", timeout => $timeout);
|
2019-11-06 12:55:27 +00:00
|
|
|
if (get_var("SERIAL_CONSOLE") && get_var("OFW")) {
|
2019-11-20 17:04:31 +00:00
|
|
|
# for some reason the check for a prompt times out here, even
|
|
|
|
# though '# ' is clearly in the terminal log; hack it out
|
|
|
|
my $origprompt = $testapi::distri->{serial_term_prompt};
|
|
|
|
$testapi::distri->{serial_term_prompt} = '';
|
2019-11-06 12:55:27 +00:00
|
|
|
$self->root_console();
|
|
|
|
# we need to force the system to load a console on both hvc1
|
|
|
|
# and hvc2 for ppc64 serial console post-install tests
|
|
|
|
assert_script_run 'chroot /mnt/sysimage systemctl enable serial-getty@hvc1';
|
|
|
|
assert_script_run 'chroot /mnt/sysimage systemctl enable serial-getty@hvc2';
|
2019-11-20 17:04:31 +00:00
|
|
|
$testapi::distri->{serial_term_prompt} = $origprompt;
|
2019-11-06 12:55:27 +00:00
|
|
|
# back to anaconda ui
|
2023-05-02 00:07:06 +00:00
|
|
|
select_console("user-virtio-console");
|
2019-11-06 12:55:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
assert_screen "anaconda_install_text_done", $timeout;
|
|
|
|
}
|
|
|
|
console_type_wait("\n");
|
2016-09-07 08:34:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sub test_flags {
|
2022-07-28 20:32:57 +00:00
|
|
|
return {fatal => 1};
|
2016-09-07 08:34:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|
|
|
|
|
|
|
|
# vim: set sw=4 et:
|