2015-08-06 09:01:41 +00:00
|
|
|
package anacondatest;
|
create fedora base class, factor out console login
Summary:
Root console in anaconda got broken by RHBZ #1222413 - no
shell on tty2. Decided to clean up console use in general as
part of fixing it.
This creates a class 'fedorabase' and has 'anacondalog' and
'fedoralog' both inherit from it. boot_to_login_screen is
moved there (as it seems appropriate) and it has a new
method, console_login, which basically handles 'get me a
shell on a console': if we're already at one it returns,
if not it'll type the user name and the password *if
necessary* (sometimes it's not) and return once it sees a
prompt. It takes a hash of named parameters for user,
password and 'check', which is whether it should die if it
fails to reach a console or not (some users don't want it
to).
anacondalog and fedoralog both get 'root_console' methods
which do something appropriate and then call
console_login; both have a hash of named parameters,
anacondalog's version only bothers with 'check', while
fedoralog's also accepts 'tty' to pick the tty to use.
This also adjusts all things which try to get to a console
prompt to use either root_console or console_login as
appropriate.
It also tweaks the needle tags a bit, drops some unneeded
needles, and adds a new 'user console prompt' needle; we
really just need two versions of the root prompt needle
and two of the user prompt needle (one for <F23, one for
F23+ - the console font changed in F23, and the @ character
at least doesn't match between the two). I think we still
need the <F23 case for upgrade tests, for now.
Test Plan:
Do a full test run and see that more tests
succeed. I've done a run on happyassassin with a hack to
workaround the SELinux issue for interactive installs,
and the results look good. I also fiddled about a bit to
test some different cases, like forcing a failure in a
live test to test post_fail_hook (and hence root_console)
in that scenario, and forcing failures after some console
commands had been run to check that it DTRT when we've
already reached a console, etc.
Reviewers: jskladan, garretraziel
Reviewed By: jskladan, garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D462
2015-07-22 18:24:40 +00:00
|
|
|
use base 'fedorabase';
|
2015-02-13 14:08:29 +00:00
|
|
|
|
2015-08-05 06:23:59 +00:00
|
|
|
# base class for all Anaconda (installation) tests
|
|
|
|
|
|
|
|
# should be used in tests where Anaconda is running - when it makes sense
|
|
|
|
# to upload Anaconda logs when something fails
|
|
|
|
|
2015-02-13 14:08:29 +00:00
|
|
|
use testapi;
|
|
|
|
|
|
|
|
sub post_fail_hook {
|
|
|
|
my $self = shift;
|
2015-04-03 11:42:59 +00:00
|
|
|
|
anaconda crash reporting: update needles, click Report again
Summary:
First off, this revises the anaconda crash handling needles a
bit. We ditch gtk3195 and update anaconda_error to reflect
current F24/Rawhide. We keep the old anaconda_error around for
now as anaconda_error-23, to handle crashes in the F23 two-week
Atomic nightlies. We also add an 'early' variant, which is for
when (I think) the installer crashes very early, before it's
loaded in GTK+ settings; when that happens, the dialog uses a
different font. The screenshot comes from a recent Rawhide test
that crashed.
We also restore the anaconda `post_fail_hook` code to click
the Report button when a crash happens. This was erroneously
removed in D637. Before the Report button is clicked, the
`anaconda-tb` file exists but the libreport stuff in `/var/tmp`
does not. By removing this, we lost the libreport bits from
the uploaded files, which makes it harder to report crashes. So
let's add it back.
Finally we fix the actual tarring and uploading of `/var/tmp`;
also in D637 this got broken because it was being tarred up in
whatever directory the commands happened to be running in, but
we were still trying to upload it from `/var/tmp`.
https://openqa.stg.fedoraproject.org/tests/8444 was run with
these changes, and has `/var/tmp` correctly uploaded.
Test Plan:
Run some test that crashes, make sure the crash
handling all works correctly.
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D768
2016-03-08 16:10:51 +00:00
|
|
|
# if error dialog is shown, click "report" - it then creates directory structure for ABRT
|
2015-04-03 11:42:59 +00:00
|
|
|
my $has_traceback = 0;
|
|
|
|
if (check_screen "anaconda_error", 10) {
|
anaconda crash reporting: update needles, click Report again
Summary:
First off, this revises the anaconda crash handling needles a
bit. We ditch gtk3195 and update anaconda_error to reflect
current F24/Rawhide. We keep the old anaconda_error around for
now as anaconda_error-23, to handle crashes in the F23 two-week
Atomic nightlies. We also add an 'early' variant, which is for
when (I think) the installer crashes very early, before it's
loaded in GTK+ settings; when that happens, the dialog uses a
different font. The screenshot comes from a recent Rawhide test
that crashed.
We also restore the anaconda `post_fail_hook` code to click
the Report button when a crash happens. This was erroneously
removed in D637. Before the Report button is clicked, the
`anaconda-tb` file exists but the libreport stuff in `/var/tmp`
does not. By removing this, we lost the libreport bits from
the uploaded files, which makes it harder to report crashes. So
let's add it back.
Finally we fix the actual tarring and uploading of `/var/tmp`;
also in D637 this got broken because it was being tarred up in
whatever directory the commands happened to be running in, but
we were still trying to upload it from `/var/tmp`.
https://openqa.stg.fedoraproject.org/tests/8444 was run with
these changes, and has `/var/tmp` correctly uploaded.
Test Plan:
Run some test that crashes, make sure the crash
handling all works correctly.
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D768
2016-03-08 16:10:51 +00:00
|
|
|
assert_and_click "anaconda_error_report";
|
2015-04-03 11:42:59 +00:00
|
|
|
$has_traceback = 1;
|
|
|
|
}
|
|
|
|
|
create fedora base class, factor out console login
Summary:
Root console in anaconda got broken by RHBZ #1222413 - no
shell on tty2. Decided to clean up console use in general as
part of fixing it.
This creates a class 'fedorabase' and has 'anacondalog' and
'fedoralog' both inherit from it. boot_to_login_screen is
moved there (as it seems appropriate) and it has a new
method, console_login, which basically handles 'get me a
shell on a console': if we're already at one it returns,
if not it'll type the user name and the password *if
necessary* (sometimes it's not) and return once it sees a
prompt. It takes a hash of named parameters for user,
password and 'check', which is whether it should die if it
fails to reach a console or not (some users don't want it
to).
anacondalog and fedoralog both get 'root_console' methods
which do something appropriate and then call
console_login; both have a hash of named parameters,
anacondalog's version only bothers with 'check', while
fedoralog's also accepts 'tty' to pick the tty to use.
This also adjusts all things which try to get to a console
prompt to use either root_console or console_login as
appropriate.
It also tweaks the needle tags a bit, drops some unneeded
needles, and adds a new 'user console prompt' needle; we
really just need two versions of the root prompt needle
and two of the user prompt needle (one for <F23, one for
F23+ - the console font changed in F23, and the @ character
at least doesn't match between the two). I think we still
need the <F23 case for upgrade tests, for now.
Test Plan:
Do a full test run and see that more tests
succeed. I've done a run on happyassassin with a hack to
workaround the SELinux issue for interactive installs,
and the results look good. I also fiddled about a bit to
test some different cases, like forcing a failure in a
live test to test post_fail_hook (and hence root_console)
in that scenario, and forcing failures after some console
commands had been run to check that it DTRT when we've
already reached a console, etc.
Reviewers: jskladan, garretraziel
Reviewed By: jskladan, garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D462
2015-07-22 18:24:40 +00:00
|
|
|
$self->root_console(check=>0);
|
|
|
|
if (check_screen "root_console", 10) {
|
allow failure when uploading anaconda logs
Summary:
This requires a PR I sent upstream:
https://github.com/os-autoinst/os-autoinst/pull/490
This change is in os-autoinst -10. However, with older packages
it won't crash or anything, it'll just behave as before.
With the change, this allows log upload to fail, so if one of
the logs is missing, the hook doesn't immediately die and fail
to upload the rest of the logs. Various anaconda logs are not
always present: the DNF logs are not present for Atomic or live
installs, and the X.log and syslog are not present for live
installs. Adding a fail-tolerant mode to upstream upload_logs
seemed a better option than testing for the existence of each
log file prior to uploading it, or adding a bunch of GET_VAR
calls to try and figure out which log files 'should' exist.
Test Plan:
Run an Atomic or live install test that fails, and
check what logs get uploaded. You can just test a current
Rawhide Atomic installer ISO, as they're crashing right now.
Without this patch (and the os-autoinst update) the hook dies
when it tries to upload dnf.log, so the traceback and /var/tmp
archive don't get uploaded; with this patch all the present
logs should get uploaded. Compare:
https://openqa.fedoraproject.org/tests/14834
https://openqa.stg.fedoraproject.org/tests/15371
(I tested this out on staging).
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D834
2016-05-06 20:44:06 +00:00
|
|
|
upload_logs "/tmp/X.log", failok=>1;
|
|
|
|
upload_logs "/tmp/anaconda.log", failok=>1;
|
|
|
|
upload_logs "/tmp/packaging.log", failok=>1;
|
|
|
|
upload_logs "/tmp/storage.log", failok=>1;
|
|
|
|
upload_logs "/tmp/syslog", failok=>1;
|
|
|
|
upload_logs "/tmp/program.log", failok=>1;
|
|
|
|
upload_logs "/tmp/dnf.log", failok=>1;
|
|
|
|
upload_logs "/tmp/dnf.librepo.log", failok=>1;
|
|
|
|
upload_logs "/tmp/dnf.rpm.log", failok=>1;
|
2015-02-19 14:40:33 +00:00
|
|
|
|
2015-04-03 11:42:59 +00:00
|
|
|
if ($has_traceback) {
|
2015-11-04 13:38:36 +00:00
|
|
|
# Upload Anaconda traceback logs
|
|
|
|
script_run "tar czf /tmp/anaconda_tb.tar.gz /tmp/anaconda-tb-*";
|
|
|
|
upload_logs "/tmp/anaconda_tb.tar.gz";
|
2015-04-03 11:42:59 +00:00
|
|
|
}
|
2015-02-19 15:55:29 +00:00
|
|
|
|
2015-11-04 13:38:36 +00:00
|
|
|
# Upload all ABRT logs
|
anaconda crash reporting: update needles, click Report again
Summary:
First off, this revises the anaconda crash handling needles a
bit. We ditch gtk3195 and update anaconda_error to reflect
current F24/Rawhide. We keep the old anaconda_error around for
now as anaconda_error-23, to handle crashes in the F23 two-week
Atomic nightlies. We also add an 'early' variant, which is for
when (I think) the installer crashes very early, before it's
loaded in GTK+ settings; when that happens, the dialog uses a
different font. The screenshot comes from a recent Rawhide test
that crashed.
We also restore the anaconda `post_fail_hook` code to click
the Report button when a crash happens. This was erroneously
removed in D637. Before the Report button is clicked, the
`anaconda-tb` file exists but the libreport stuff in `/var/tmp`
does not. By removing this, we lost the libreport bits from
the uploaded files, which makes it harder to report crashes. So
let's add it back.
Finally we fix the actual tarring and uploading of `/var/tmp`;
also in D637 this got broken because it was being tarred up in
whatever directory the commands happened to be running in, but
we were still trying to upload it from `/var/tmp`.
https://openqa.stg.fedoraproject.org/tests/8444 was run with
these changes, and has `/var/tmp` correctly uploaded.
Test Plan:
Run some test that crashes, make sure the crash
handling all works correctly.
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D768
2016-03-08 16:10:51 +00:00
|
|
|
script_run "tar czf /var/tmp/var_tmp.tar.gz /var/tmp";
|
2015-11-04 13:38:36 +00:00
|
|
|
upload_logs "/var/tmp/var_tmp.tar.gz";
|
|
|
|
|
|
|
|
# Upload /var/log
|
|
|
|
script_run "tar czf /tmp/var_log.tar.gz /var/log";
|
|
|
|
upload_logs "/tmp/var_log.tar.gz";
|
2015-12-09 16:44:52 +00:00
|
|
|
|
|
|
|
# Upload anaconda core dump, if there is one
|
2015-12-14 16:29:19 +00:00
|
|
|
script_run "ls /tmp/anaconda.core.* && tar czf /tmp/anaconda.core.tar.gz /tmp/anaconda.core.*";
|
allow failure when uploading anaconda logs
Summary:
This requires a PR I sent upstream:
https://github.com/os-autoinst/os-autoinst/pull/490
This change is in os-autoinst -10. However, with older packages
it won't crash or anything, it'll just behave as before.
With the change, this allows log upload to fail, so if one of
the logs is missing, the hook doesn't immediately die and fail
to upload the rest of the logs. Various anaconda logs are not
always present: the DNF logs are not present for Atomic or live
installs, and the X.log and syslog are not present for live
installs. Adding a fail-tolerant mode to upstream upload_logs
seemed a better option than testing for the existence of each
log file prior to uploading it, or adding a bunch of GET_VAR
calls to try and figure out which log files 'should' exist.
Test Plan:
Run an Atomic or live install test that fails, and
check what logs get uploaded. You can just test a current
Rawhide Atomic installer ISO, as they're crashing right now.
Without this patch (and the os-autoinst update) the hook dies
when it tries to upload dnf.log, so the traceback and /var/tmp
archive don't get uploaded; with this patch all the present
logs should get uploaded. Compare:
https://openqa.fedoraproject.org/tests/14834
https://openqa.stg.fedoraproject.org/tests/15371
(I tested this out on staging).
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D834
2016-05-06 20:44:06 +00:00
|
|
|
upload_logs "/tmp/anaconda.core.tar.gz", failok=>1;
|
2015-02-13 14:08:29 +00:00
|
|
|
}
|
2015-03-18 21:28:03 +00:00
|
|
|
else {
|
|
|
|
save_screenshot;
|
|
|
|
}
|
2015-02-13 14:08:29 +00:00
|
|
|
}
|
|
|
|
|
create fedora base class, factor out console login
Summary:
Root console in anaconda got broken by RHBZ #1222413 - no
shell on tty2. Decided to clean up console use in general as
part of fixing it.
This creates a class 'fedorabase' and has 'anacondalog' and
'fedoralog' both inherit from it. boot_to_login_screen is
moved there (as it seems appropriate) and it has a new
method, console_login, which basically handles 'get me a
shell on a console': if we're already at one it returns,
if not it'll type the user name and the password *if
necessary* (sometimes it's not) and return once it sees a
prompt. It takes a hash of named parameters for user,
password and 'check', which is whether it should die if it
fails to reach a console or not (some users don't want it
to).
anacondalog and fedoralog both get 'root_console' methods
which do something appropriate and then call
console_login; both have a hash of named parameters,
anacondalog's version only bothers with 'check', while
fedoralog's also accepts 'tty' to pick the tty to use.
This also adjusts all things which try to get to a console
prompt to use either root_console or console_login as
appropriate.
It also tweaks the needle tags a bit, drops some unneeded
needles, and adds a new 'user console prompt' needle; we
really just need two versions of the root prompt needle
and two of the user prompt needle (one for <F23, one for
F23+ - the console font changed in F23, and the @ character
at least doesn't match between the two). I think we still
need the <F23 case for upgrade tests, for now.
Test Plan:
Do a full test run and see that more tests
succeed. I've done a run on happyassassin with a hack to
workaround the SELinux issue for interactive installs,
and the results look good. I also fiddled about a bit to
test some different cases, like forcing a failure in a
live test to test post_fail_hook (and hence root_console)
in that scenario, and forcing failures after some console
commands had been run to check that it DTRT when we've
already reached a console, etc.
Reviewers: jskladan, garretraziel
Reviewed By: jskladan, garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D462
2015-07-22 18:24:40 +00:00
|
|
|
sub root_console {
|
|
|
|
my $self = shift;
|
|
|
|
my %args = (
|
2015-08-05 06:23:59 +00:00
|
|
|
check => 1, # whether to fail when console wasn't reached
|
create fedora base class, factor out console login
Summary:
Root console in anaconda got broken by RHBZ #1222413 - no
shell on tty2. Decided to clean up console use in general as
part of fixing it.
This creates a class 'fedorabase' and has 'anacondalog' and
'fedoralog' both inherit from it. boot_to_login_screen is
moved there (as it seems appropriate) and it has a new
method, console_login, which basically handles 'get me a
shell on a console': if we're already at one it returns,
if not it'll type the user name and the password *if
necessary* (sometimes it's not) and return once it sees a
prompt. It takes a hash of named parameters for user,
password and 'check', which is whether it should die if it
fails to reach a console or not (some users don't want it
to).
anacondalog and fedoralog both get 'root_console' methods
which do something appropriate and then call
console_login; both have a hash of named parameters,
anacondalog's version only bothers with 'check', while
fedoralog's also accepts 'tty' to pick the tty to use.
This also adjusts all things which try to get to a console
prompt to use either root_console or console_login as
appropriate.
It also tweaks the needle tags a bit, drops some unneeded
needles, and adds a new 'user console prompt' needle; we
really just need two versions of the root prompt needle
and two of the user prompt needle (one for <F23, one for
F23+ - the console font changed in F23, and the @ character
at least doesn't match between the two). I think we still
need the <F23 case for upgrade tests, for now.
Test Plan:
Do a full test run and see that more tests
succeed. I've done a run on happyassassin with a hack to
workaround the SELinux issue for interactive installs,
and the results look good. I also fiddled about a bit to
test some different cases, like forcing a failure in a
live test to test post_fail_hook (and hence root_console)
in that scenario, and forcing failures after some console
commands had been run to check that it DTRT when we've
already reached a console, etc.
Reviewers: jskladan, garretraziel
Reviewed By: jskladan, garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D462
2015-07-22 18:24:40 +00:00
|
|
|
@_);
|
|
|
|
|
|
|
|
if (get_var("LIVE")) {
|
|
|
|
send_key "ctrl-alt-f2";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
# Working around RHBZ 1222413, no console on tty2
|
|
|
|
send_key "ctrl-alt-f1";
|
|
|
|
send_key "ctrl-b";
|
|
|
|
send_key "2";
|
|
|
|
}
|
|
|
|
$self->console_login(user=>"root",check=>$args{check});
|
|
|
|
}
|
|
|
|
|
2015-07-31 08:31:27 +00:00
|
|
|
sub select_disks {
|
|
|
|
my ($self, $disks) = @_;
|
|
|
|
$disks ||= 1;
|
|
|
|
# Anaconda hub
|
|
|
|
assert_screen "anaconda_main_hub", 300; #
|
|
|
|
# Damn animation delay can cause bad clicks here too - wait for it
|
|
|
|
sleep 1;
|
|
|
|
assert_and_click "anaconda_main_hub_install_destination";
|
|
|
|
|
|
|
|
if (get_var('NUMDISKS') > 1) {
|
|
|
|
# Multi-disk case. Select however many disks the test needs. If
|
|
|
|
# $disks is 0, this will do nothing, and 0 disks will be selected.
|
|
|
|
for my $n (1 .. $disks) {
|
|
|
|
assert_and_click "anaconda_install_destination_select_disk_$n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
# Single disk case.
|
|
|
|
if ($disks == 0) {
|
|
|
|
# Clicking will *de*-select.
|
|
|
|
assert_and_click "anaconda_install_destination_select_disk_1";
|
|
|
|
}
|
|
|
|
elsif ($disks > 1) {
|
|
|
|
die "Only one disk is connected! Cannot select $disks disks.";
|
|
|
|
}
|
|
|
|
# For exactly 1 disk, we don't need to do anything.
|
|
|
|
}
|
2015-08-10 18:01:12 +00:00
|
|
|
|
|
|
|
# If this is a custom partitioning test, select custom partitioning.
|
|
|
|
if (get_var('PARTITIONING') =~ /^custom_/) {
|
|
|
|
assert_and_click "anaconda_manual_partitioning";
|
|
|
|
}
|
2015-07-31 08:31:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub custom_scheme_select {
|
|
|
|
my ($self, $scheme) = @_;
|
|
|
|
assert_and_click "anaconda_part_scheme";
|
2015-08-10 18:01:12 +00:00
|
|
|
# Move the mouse away from the menu
|
|
|
|
mouse_set(10, 10);
|
2015-07-31 08:31:27 +00:00
|
|
|
assert_and_click "anaconda_part_scheme_$scheme";
|
|
|
|
}
|
|
|
|
|
|
|
|
sub custom_change_type {
|
2015-08-10 18:01:12 +00:00
|
|
|
my ($self, $type, $part) = @_;
|
|
|
|
$part ||= "root";
|
|
|
|
assert_and_click "anaconda_part_select_$part";
|
2015-07-31 08:31:27 +00:00
|
|
|
assert_and_click "anaconda_part_device_type";
|
2015-08-10 18:01:12 +00:00
|
|
|
# Move the mouse away from the menu
|
|
|
|
mouse_set(10, 10);
|
2015-07-31 08:31:27 +00:00
|
|
|
assert_and_click "anaconda_part_device_type_$type";
|
|
|
|
assert_and_click "anaconda_part_update_settings";
|
|
|
|
}
|
|
|
|
|
2015-08-10 18:01:12 +00:00
|
|
|
sub custom_change_fs {
|
|
|
|
my ($self, $fs, $part) = @_;
|
|
|
|
$part ||= "root";
|
|
|
|
assert_and_click "anaconda_part_select_$part";
|
2016-05-20 19:56:44 +00:00
|
|
|
# if fs is already set correctly, do nothing
|
|
|
|
return if (check_screen "anaconda_part_fs_${fs}_selected", 5);
|
2015-08-10 18:01:12 +00:00
|
|
|
assert_and_click "anaconda_part_fs";
|
|
|
|
# Move the mouse away from the menu
|
|
|
|
mouse_set(10, 10);
|
|
|
|
assert_and_click "anaconda_part_fs_$fs";
|
|
|
|
assert_and_click "anaconda_part_update_settings";
|
|
|
|
}
|
|
|
|
|
2015-08-19 21:41:41 +00:00
|
|
|
sub custom_delete_part {
|
|
|
|
my ($self, $part) = @_;
|
|
|
|
return if not $part;
|
|
|
|
assert_and_click "anaconda_part_select_$part";
|
|
|
|
assert_and_click "anaconda_part_delete";
|
|
|
|
}
|
|
|
|
|
2016-05-20 14:52:55 +00:00
|
|
|
sub switch_layout {
|
|
|
|
# switch to 'native' or 'us' keyboard layout
|
|
|
|
my ($self, $layout) = @_;
|
|
|
|
$layout //= 'us';
|
|
|
|
# if already selected, we're good
|
|
|
|
return if (check_screen "anaconda_layout_$layout", 3);
|
|
|
|
send_key "alt-shift";
|
|
|
|
assert_screen "anaconda_layout_$layout", 3;
|
|
|
|
}
|
|
|
|
|
2015-02-13 14:08:29 +00:00
|
|
|
1;
|
|
|
|
|
|
|
|
# vim: set sw=4 et:
|