1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-16 03:33:08 +00:00
os-autoinst-distri-fedora/lib/anacondatest.pm
Adam Williamson 0305c5fcd0 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 08:10:51 -08:00

148 lines
4.3 KiB
Perl

package anacondatest;
use base 'fedorabase';
# 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
use testapi;
sub post_fail_hook {
my $self = shift;
# if error dialog is shown, click "report" - it then creates directory structure for ABRT
my $has_traceback = 0;
if (check_screen "anaconda_error", 10) {
assert_and_click "anaconda_error_report";
$has_traceback = 1;
}
$self->root_console(check=>0);
if (check_screen "root_console", 10) {
upload_logs "/tmp/X.log";
upload_logs "/tmp/anaconda.log";
upload_logs "/tmp/packaging.log";
upload_logs "/tmp/storage.log";
upload_logs "/tmp/syslog";
upload_logs "/tmp/program.log";
upload_logs "/tmp/dnf.log";
upload_logs "/tmp/dnf.librepo.log";
upload_logs "/tmp/dnf.rpm.log";
if ($has_traceback) {
# Upload Anaconda traceback logs
script_run "tar czf /tmp/anaconda_tb.tar.gz /tmp/anaconda-tb-*";
upload_logs "/tmp/anaconda_tb.tar.gz";
}
# Upload all ABRT logs
script_run "tar czf /var/tmp/var_tmp.tar.gz /var/tmp";
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";
# Upload anaconda core dump, if there is one
script_run "ls /tmp/anaconda.core.* && tar czf /tmp/anaconda.core.tar.gz /tmp/anaconda.core.*";
upload_logs "/tmp/anaconda.core.tar.gz";
}
else {
save_screenshot;
}
}
sub root_console {
my $self = shift;
my %args = (
check => 1, # whether to fail when console wasn't reached
@_);
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});
}
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.
}
# If this is a custom partitioning test, select custom partitioning.
if (get_var('PARTITIONING') =~ /^custom_/) {
assert_and_click "anaconda_manual_partitioning";
}
}
sub custom_scheme_select {
my ($self, $scheme) = @_;
assert_and_click "anaconda_part_scheme";
# Move the mouse away from the menu
mouse_set(10, 10);
assert_and_click "anaconda_part_scheme_$scheme";
}
sub custom_change_type {
my ($self, $type, $part) = @_;
$part ||= "root";
assert_and_click "anaconda_part_select_$part";
assert_and_click "anaconda_part_device_type";
# Move the mouse away from the menu
mouse_set(10, 10);
assert_and_click "anaconda_part_device_type_$type";
assert_and_click "anaconda_part_update_settings";
}
sub custom_change_fs {
my ($self, $fs, $part) = @_;
$part ||= "root";
assert_and_click "anaconda_part_select_$part";
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";
}
sub custom_delete_part {
my ($self, $part) = @_;
return if not $part;
assert_and_click "anaconda_part_select_$part";
assert_and_click "anaconda_part_delete";
}
1;
# vim: set sw=4 et: