From 7687a3aa34fd8621e96b7de2236cc81d79bf127a Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 8 Dec 2016 08:58:29 -0800 Subject: [PATCH] Add a non-fatal console AVC / crash post-install check Summary: This has all console tests check for AVCs (with ausearch) and crashes (with coredumpctl) at post-install stage. It's non- fatal as this doesn't really mean the test failed, but we want to spot when there are unexpected AVCs or crashes. Test Plan: Run some console tests, check it works right. I only tested with one test, since so many are broken on Rawhide ATM Reviewers: jskladan, garretraziel Reviewed By: garretraziel Subscribers: tflink Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1066 --- main.pm | 5 +++++ tests/_console_avc_crash.pm | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 tests/_console_avc_crash.pm diff --git a/main.pm b/main.pm index 2bfcb0ca..0d19e884 100644 --- a/main.pm +++ b/main.pm @@ -204,6 +204,11 @@ sub load_postinstall_tests() { autotest::loadtest "tests/uefi_postinstall.pm"; } + # console avc / crash check (desktops have specific tests for this) + if (!get_var("DESKTOP")) { + autotest::loadtest "tests/_console_avc_crash.pm"; + } + # generic post-install test load if (get_var("POSTINSTALL")) { my @pis = split(/ /, get_var("POSTINSTALL")); diff --git a/tests/_console_avc_crash.pm b/tests/_console_avc_crash.pm new file mode 100644 index 00000000..b0b31634 --- /dev/null +++ b/tests/_console_avc_crash.pm @@ -0,0 +1,24 @@ +use base "installedtest"; +use strict; +use testapi; + +sub run { + my $self = shift; + $self->root_console(tty=>3); + # check there are no AVCs. We use ! because this returns 1 + validate_script_output '! ausearch -m avc -ts yesterday 2>&1', sub { $_ =~ m// }; + # check there are no crashes + validate_script_output '! coredumpctl list 2>&1', sub { $_ =~ m/No coredumps found/ }; +} + +sub test_flags { + # without anything - rollback to 'lastgood' snapshot if failed + # 'fatal' - whole test suite is in danger if this fails + # 'milestone' - after this test succeeds, update 'lastgood' + # 'important' - if this fails, set the overall state to 'fail' + return {}; +} + +1; + +# vim: set sw=4 et: