[apparmor] [PATCH] add "VERBOSE" mode to kernel regression tests
Kees Cook
kees at ubuntu.com
Mon Jul 26 07:32:39 BST 2010
There didn't seem to be a way to see individual test successes, so I added
a check for "VERBOSE=1" in the kernel regression testsuite.
=== modified file 'tests/regression/apparmor/README'
--- tests/regression/apparmor/README 2010-07-24 15:54:38 +0000
+++ tests/regression/apparmor/README 2010-07-24 15:57:24 +0000
@@ -12,10 +12,13 @@
Test output
===========
-No output is displayed for a passing test. The makefile will output
+By default, no output is displayed for a passing test. The makefile will
+output:
running <testname> for each test.
-Output other than this indicates a problem.
+To have verbose output with each subtest reporting successes, set the
+environment variable VERBOSE=1:
+ sudo VERBOSE=1 make tests
There are three typical failure scenarios:
- Test failed when it was expected to pass
=== modified file 'tests/regression/apparmor/prologue.inc'
--- tests/regression/apparmor/prologue.inc 2010-04-27 09:37:30 +0000
+++ tests/regression/apparmor/prologue.inc 2010-07-24 15:57:24 +0000
@@ -1,9 +1,14 @@
# vim:syntax=sh
#
-# prologue.inc
-#
# Test infrastructure support.
#
+# Copyright 2010 Canonical, Ltd.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, version 2 of the
+# License.
+#
# This file should be included by each test case
# It does a lot of hidden 'magic', Downside is that
# this magic makes debugging fauling tests more difficult.
@@ -253,6 +258,7 @@
then
echo "Error: ${testname} passed. Test '${_testdesc}' was expected to '${_pfmode}'"
testfailed
+ return
elif [ "$_pfmode" == "pass" -a -n "${_known}" ]
then
echo "Alert: ${testname} passed. Test '${_testdesc}' was marked as expected pass but known problem (xpass)"
@@ -262,6 +268,7 @@
then
echo "Error: ${testname} failed. Test '${_testdesc}' was expected to '${_pfmode}'. Reason for failure '${ret}'"
testfailed
+ return
elif [ "$_pfmode" == "fail" -a -n "${_known}" ]
then
echo "Alert: ${testname} failed. Test '${_testdesc}' was marked as expected fail but known problem (xfail)."
@@ -274,16 +281,23 @@
then
echo "Error: ${testname} failed. Test '${_testdesc}' was expected to terminate with signal ${expectedsig}${_known}. Instead it terminated with signal ${killedsig}"
testfailed
+ return
fi
;;
*) echo "Error: ${testname} failed. Test '${_testdesc}' was expected to '${_pfmode}'${_known}. Reason for failure 'killed by signal ${killedsig}'"
testfailed
+ return
;;
esac
;;
*) testerror
+ return
;;
esac
+
+ if [ -n "$VERBOSE" ]; then
+ echo "ok: ${_testdesc}"
+ fi
}
runchecktest()
--
Kees Cook
Ubuntu Security Team
More information about the AppArmor
mailing list