b67f604894
Summary: This adds a couple of new exporter modules, renames main_common to utils (this is a better name: openSUSE's main_common is functions used in main.pm, utils is what they call their module full of miscellaneous commonly-used functions), and moves a bunch of utility functions that were previously needlessly implemented as instance methods in base classes into the exporter modules. That means we can get rid of all the annoying $self-> syntax for calling them. We get rid of `fedorabase` entirely, as it's no longer useful for anything. Other base classes keep the 'standard' methods (like `post_fail_hook`) and methods which actually need to be methods (like `root_console`, whose behaviour is different in anacondatest and installedtest). Test Plan: Do a full test suite run and check everything lines up. There should be no functional differences from before at all, this is just a re-org. Reviewers: jskladan, garretraziel_but_actually_jsedlak_who_uses_stupid_nicknames Reviewed By: garretraziel_but_actually_jsedlak_who_uses_stupid_nicknames Subscribers: tflink Differential Revision: https://phab.qa.fedoraproject.org/D1080
51 lines
1.4 KiB
Perl
51 lines
1.4 KiB
Perl
package installedtest;
|
|
use base 'basetest';
|
|
|
|
# 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;
|
|
use utils;
|
|
|
|
sub root_console {
|
|
# Switch to a default or specified TTY and log in as root.
|
|
my $self = shift;
|
|
my %args = (
|
|
tty => 1, # what TTY to login to
|
|
@_);
|
|
|
|
send_key "ctrl-alt-f$args{tty}";
|
|
console_login;
|
|
}
|
|
|
|
sub post_fail_hook {
|
|
my $self = shift;
|
|
|
|
$self->root_console(tty=>6);
|
|
|
|
# We can't rely on tar being in minimal installs
|
|
assert_script_run "dnf -y install tar", 180;
|
|
|
|
# Note: script_run returns the exit code, so the logic looks weird.
|
|
# We're testing that the directory exists and contains something.
|
|
unless (script_run 'test -n "$(ls -A /var/tmp/abrt)" && cd /var/tmp/abrt && tar czvf tmpabrt.tar.gz *') {
|
|
upload_logs "/var/tmp/abrt/tmpabrt.tar.gz";
|
|
}
|
|
|
|
unless (script_run 'test -n "$(ls -A /var/spool/abrt)" && cd /var/spool/abrt && tar czvf spoolabrt.tar.gz *') {
|
|
upload_logs "/var/spool/abrt/spoolabrt.tar.gz";
|
|
}
|
|
|
|
# Upload /var/log
|
|
# lastlog can mess up tar sometimes and it's not much use
|
|
unless (script_run "tar czvf /tmp/var_log.tar.gz --exclude='lastlog' /var/log") {
|
|
upload_logs "/tmp/var_log.tar.gz";
|
|
}
|
|
}
|
|
|
|
1;
|
|
|
|
# vim: set sw=4 et:
|