1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-12-11 05:43:11 +00:00
os-autoinst-distri-fedora/tests/_console_avc_crash.pm
Adam Williamson f752b4c00a Don't snapshot after wait_login tests (usually)
We currently snapshot after every run of _console_wait_login or
_graphical_wait_login, which means we snapshot *twice* on most
update tests as those modules get run twice. However, we almost
never use those snapshots. Snapshotting takes quite some time,
and hits the disk pretty hard, so we should avoid it unless it
is really needed.

We only have a few modules that are not fatal (and so might use
the snapshots), and most of those don't run after one of these
tests, or run after a later module that's also a milestone. Best
I can tell, only two test suites really need to use a snapshot
from a login test: server_cockpit_updates and modularity_tests.
To handle these and potential future cases, we'll add a new
module that does nothing, but is marked 'milestone', so it will
take a snapshot, and load that test after the login test if the
var LOGIN_SNAPSHOT is set, and set that var for those two suites.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2022-12-08 09:59:23 -08:00

41 lines
1.3 KiB
Perl

use base "installedtest";
use strict;
use utils;
use testapi;
sub run {
my $self = shift;
$self->root_console(tty => 3, timeout => 30);
# if this is a non-English, non-switched layout, load US layout
# at this point
# FIXME: this is all kind of a mess, as on such configs we need
# native layout to log in to a console but US layout to type
# anything at a console. the more advanced upstream 'console'
# handling may help us here if we switch to it
console_loadkeys_us;
# check there are no AVCs. We expect an error here: if we don't
# get an error, it means there *are* AVCs.
my $hook_run = 0;
unless (script_run 'ausearch -m avc -ts yesterday > /tmp/avcs.txt 2>&1') {
record_soft_failure "AVC(s) found (see avcs.txt log)";
upload_logs "/tmp/avcs.txt";
# Run the post-fail hook so we have all the logs
$self->post_fail_hook();
$hook_run = 1;
}
# check there are no crashes. Similarly expect an error here
unless (script_run 'coredumpctl list > /tmp/coredumps.txt 2>&1') {
record_soft_failure "Crash(es) found (see coredumps.txt log)";
upload_logs "/tmp/coredumps.txt";
$self->post_fail_hook() unless ($hook_run);
}
}
sub test_flags {
return {fatal => 1};
}
1;
# vim: set sw=4 et: