os-autoinst-distri-rocky/lib/installedtest.pm
Adam Williamson 2df55efb49 add desktop_terminal test, refactor test loading a bit
Summary:
I really just want to add the desktop_terminal test, but I think
this refactor is in order now. It splits up loading of the
various test phases (much as SUSE do it) and allows us to run
the post-install tests without the install tests, for e.g. I
tweaked things to allow the upgrade tests to use the existing
_wait_login tests for final login and combine the two upgrade
postinstall tests into one simple one.

This comes with a bit of a behaviour change to make graphical
wait login behave the same as console wait login: it will log
in unless USER_LOGIN is set to 'false'. Previously it only
logged in if both USER_LOGIN and USER_PASSWORD were set, which
I don't think ever happened in a graphical test, so we never
actually did a graphical login. The intent here is we should do
a login on the default_install tests. That's going a bit beyond
the test case, but it seems like a reasonable thing to test. We
can set USER_LOGIN to false if we don't want to do it.

Test Plan:
Do a full test run, make sure the new tests work and
no old tests break.

Reviewers: jskladan, garretraziel

Reviewed By: garretraziel

Subscribers: tflink

Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D839
2016-05-05 16:39:47 -07:00

62 lines
1.5 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/ };
}
sub menu_launch_type {
my $self = shift;
my $app = shift;
# super does not work on KDE, because fml
send_key 'alt-f1';
# srsly KDE y u so slo
wait_still_screen 3;
type_string "$app";
wait_still_screen 3;
send_key 'ret';
}
1;
# vim: set sw=4 et: