1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-09-21 22:47:22 +00:00
os-autoinst-distri-fedora/lib/anacondatest.pm
Adam Williamson 1d6491d143 Workaround Workstation live on tty2 not tty1 (RHBZ #1635033)
In recent Rawhide, it seems the Workstation live session runs on
tty2 not tty1 for some reason. This throws off anacondatest
root_console, which assumes there'll be a vt on tty2. Handle it
by using tty3 instead if we're in a GNOME live environment.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-10-01 14:24:40 -07:00

78 lines
2.3 KiB
Perl

package anacondatest;
use base 'basetest';
# 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. Many tests using this as a
# base likely will also want to `use anaconda` for commonly-used functions.
use testapi;
use utils;
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;
} elsif (check_screen "anaconda_text_error", 10) { # also for text install
type_string "1\n";
$has_traceback = 1;
}
save_screenshot;
$self->root_console();
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;
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 (if there are any)
unless (script_run 'test -n "$(ls -A /var/tmp)" && tar czf /var/tmp/var_tmp.tar.gz /var/tmp') {
upload_logs "/var/tmp/var_tmp.tar.gz";
}
# Upload /var/log
unless (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
unless (script_run "ls /tmp/anaconda.core.* && tar czf /tmp/anaconda.core.tar.gz /tmp/anaconda.core.*") {
upload_logs "/tmp/anaconda.core.tar.gz";
}
}
sub root_console {
# Switch to an appropriate TTY and log in as root.
my $self = shift;
my %args = (
@_);
# Handle https://bugzilla.redhat.com/show_bug.cgi?id=1635033
if (get_var("LIVE") && get_var("DESKTOP") eq "gnome") {
send_key "ctrl-alt-f3";
}
else {
send_key "ctrl-alt-f2";
}
console_login(user=>"root");
}
1;
# vim: set sw=4 et: