#!/usr/bin/python3
import os, glob
testsdir="/usr/share/selinux-basics/tests"
tests = []
def register_test(test):
tests.append(test)
class ErrorBase:
def __str__(self):
raise NotImplementedError("Error with no description found. Class: %s" % self.__class__)
def fixable(self):
return False
def fix(self):
return False
class TestBase:
@staticmethod
def test():
return []
def fix():
pass
testfiles = glob.glob(os.path.join(testsdir,"[0-9]*.py"))
testfiles.sort()
for testfile in testfiles:
exec(compile(open(testfile).read(), testfile, 'exec'))
results = []
for test in tests:
results += test.test()
for result in results:
print(result)