1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-28 16:43:09 +00:00
os-autoinst-distri-fedora/lib/fedoradistribution.pm
Adam Williamson 1eb4e3dca5 Add perl syntax check test, add it to CI
Inspired by openQA's 01-compile-check-all.t, this adds a perl
test which checks the syntax of main.pm and all lib and test
files, and hooks it up to CI. Requires os-autoinst and
perl-Test-Strict.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-02-13 15:28:09 -08:00

50 lines
1.4 KiB
Perl

package fedoradistribution;
use strict;
use base 'distribution';
use Cwd;
# Fedora distribution class
# Distro-specific functions, that are actually part of the API
# (and it's completely up to us to implement them) should be here
# functions that can be reimplemented:
# ensure_installed
# x11_start_program
# become_root
# script_sudo
# type_password
# importing whole testapi creates circular dependency, so import only
# necessary functions from testapi
use testapi qw(check_var get_var send_key type_string assert_screen);
sub init() {
my ($self) = @_;
$self->SUPER::init();
# Initialize the first virtio serial console as "virtio-console"
if (check_var('BACKEND', 'qemu')) {
$self->add_console('virtio-console', 'virtio_terminal', {});
for (my $num = 1; $num < get_var('VIRTIO_CONSOLE_NUM', 1); $num++) {
# initialize second virtio serial console as
# "virtio-console1", third as "virtio-console2" etc.
$self->add_console('virtio-console' . $num, 'virtio_terminal', {socked_path => cwd() . '/virtio_console' . $num});
}
}
}
sub x11_start_program {
my ($self, $program, $timeout, $options) = @_;
send_key "alt-f2";
assert_screen "desktop_runner";
type_string $program, 20;
sleep 5; # because of KDE dialog - SUSE guys are doing the same!
send_key "ret", 1;
}
1;
# vim: set sw=4 et: