1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-09-16 21:07:22 +00:00
os-autoinst-distri-fedora/lib/anacondatest.pm
Adam Williamson 9869920f5b Use longer timeout for root console switch after liveinst
For some reason, in recent tests, switching to a console after
live install completes is taking a long time, and tests are
failing because we 'only' allow 10 seconds for the login prompt
to appear. This seems to indicate some kind of performance bug,
but we don't really want all liveinst tests to fail on in, this
is not primarily a performance testing framework. So let's
tweak the root_console / console_login bits a bit to allow a
configurable timeout for the login prompt to appear, and use
that to wait 30 secs instead of 10 in this case.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-10-06 08:44:34 -07:00

81 lines
2.5 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 = (
# 0 means use console_login's default, non-zero values
# passed to console_login
timeout => 0,
@_);
# 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", timeout=>$args{timeout});
}
1;
# vim: set sw=4 et: