Codebase list selinux-basics / lintian-fixes/main check-selinux-installation
lintian-fixes/main

Tree @lintian-fixes/main (Download .tar.gz)

check-selinux-installation @lintian-fixes/mainraw · history · blame

#!/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)