parser: fix python caching test in envs without apparmor securityfs mounted

Enabling the python caching test by default broke the build tests when
running in environments that do not contain the apparmor securityfs
mounted (think build chroots). This is because an initial check from the
shell script version of the tests was not reproduced within the python
version. This patch adds a check in the base class setUp function that
marks each testcase as skipped if apparmor's securityfs cannot be found.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
This commit is contained in:
Steve Beattie 2013-11-27 23:54:09 -08:00
parent cfd8478ba4
commit fb33689ec3

View file

@ -51,6 +51,11 @@ class AAParserCachingCommon(testlib.AATestTemplate):
# REPORT ALL THE OUTPUT
self.maxDiff = None
# skip all the things if apparmor securityfs isn't mounted
if not os.path.exists("/sys/kernel/security/apparmor"):
raise unittest.SkipTest("WARNING: /sys/kernel/security/apparmor does not exist. "
"Skipping tests")
self.tmp_dir = tempfile.mkdtemp(prefix='aa-caching-')
os.chmod(self.tmp_dir, 0o755)