mirror of
https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git
synced 2024-11-03 15:04:22 +00:00
ba90ef631a
Summary: you can't use validate_script_output like this, it doesn't just return a bool, it actually kills the test if the output doesn't validate. So any time we didn't have anything in /var/tmp/abrt, the post_fail_hook would die at that point and not upload the contents of /var/log as we wanted it to. Note that even script_output will kill the test if the return code is >0. That's OK in this case, but always be careful with these subroutines. Test Plan: Run a test that fails in post-install but doesn't produce anything in /var/tmp/abrt (you may have to artificially break something). Check that it now uploads /var/log. I noticed this while working on FreeIPA tests... Reviewers: jskladan, garretraziel Reviewed By: garretraziel Subscribers: tflink Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D830
50 lines
1.3 KiB
Perl
50 lines
1.3 KiB
Perl
package installedtest;
|
|
use base 'fedorabase';
|
|
|
|
# base class for tests that run on installed system
|
|
|
|
# should be used when with tests, where system is already installed, e. g all parts
|
|
# of upgrade tests, postinstall phases...
|
|
|
|
use testapi;
|
|
|
|
sub root_console {
|
|
my $self = shift;
|
|
my %args = (
|
|
tty => 1, # what TTY to login to
|
|
check => 1, # whether to fail when console wasn't reached
|
|
@_);
|
|
|
|
send_key "ctrl-alt-f$args{tty}";
|
|
$self->console_login(check=>$args{check});
|
|
}
|
|
|
|
sub post_fail_hook {
|
|
my $self = shift;
|
|
|
|
$self->root_console(tty=>2);
|
|
|
|
# If /var/tmp/abrt directory isn't empty (ls doesn't return empty string)
|
|
my $vartmp = script_output "ls /var/tmp/abrt";
|
|
if ($vartmp ne '') {
|
|
# Upload all ABRT logs
|
|
script_run "cd /var/tmp/abrt && tar czvf abrt.tar.gz *";
|
|
upload_logs "/var/tmp/abrt/abrt.tar.gz";
|
|
}
|
|
|
|
# Upload /var/log
|
|
script_run "tar czvf /tmp/var_log.tar.gz /var/log";
|
|
upload_logs "/tmp/var_log.tar.gz";
|
|
}
|
|
|
|
sub check_release {
|
|
my $self = shift;
|
|
my $release = shift;
|
|
my $check_command = "grep SUPPORT_PRODUCT_VERSION /usr/lib/os.release.d/os-release-fedora";
|
|
validate_script_output $check_command, sub { $_ =~ m/REDHAT_SUPPORT_PRODUCT_VERSION=$release/ };
|
|
}
|
|
|
|
1;
|
|
|
|
# vim: set sw=4 et:
|