0f5281f389
Sometimes we get a test failing because the SUT isn't connecting to the network for some reason. In this case we never get any logs, because `upload_logs` relies on being able to reacht at least the worker host system via the network. This attempts to detect when we can't ping the worker host, and in that case, send some info out over the serial line instead. Signed-off-by: Adam Williamson <awilliam@redhat.com>
106 lines
3.8 KiB
Perl
106 lines
3.8 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();
|
|
# if we don't have tar or a network connection, we'll try and at
|
|
# least send out *some* kinda info via the serial line
|
|
my $hostip = $testapi::host_ip();
|
|
if (script_run "ping -c 2 ${hostip}") {
|
|
script_run 'printf "\n** X.LOG **\n" > /dev/ttyS0';
|
|
script_run "cat /tmp/X.log > /dev/ttyS0";
|
|
script_run 'printf "\n** ANACONDA.LOG **\n" > /dev/ttyS0';
|
|
script_run "cat /tmp/anaconda.log > /dev/ttyS0";
|
|
script_run 'printf "\n** PACKAGING.LOG **\n" > /dev/ttyS0';
|
|
script_run "cat /tmp/packaging.log > /dev/ttyS0";
|
|
script_run 'printf "\n** STORAGE.LOG **\n" > /dev/ttyS0';
|
|
script_run "cat /tmp/storage.log > /dev/ttyS0";
|
|
script_run 'printf "\n** SYSLOG **\n" > /dev/ttyS0';
|
|
script_run "cat /tmp/syslog > /dev/ttyS0";
|
|
script_run 'printf "\n** PROGRAM.LOG **\n" > /dev/ttyS0';
|
|
script_run "cat /tmp/program.log > /dev/ttyS0";
|
|
script_run 'printf "\n** DNF.LOG **\n" > /dev/ttyS0';
|
|
script_run "cat /tmp/dnf.log > /dev/ttyS0";
|
|
script_run 'printf "\n** DNF.LIBREPO.LOG **\n" > /dev/ttyS0';
|
|
script_run "cat /tmp/dnf.librepo.log > /dev/ttyS0";
|
|
script_run 'printf "\n** DNF.RPM.LOG **\n" > /dev/ttyS0';
|
|
script_run "cat /tmp/dnf.rpm.log > /dev/ttyS0";
|
|
return;
|
|
}
|
|
|
|
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:
|