Collect test names in sepolicy_tests.py
Some entries in Tests were not matching their actual function (e.g.,
TestSystemTypeViolators instead of TestSystemTypeViolations).
Automatically generate the list of tests, based on the 'Test' prefix in
their name.
Test: sepolicy_tests -h
Change-Id: I1865e24c6cc1bfe15f633263897ea7530140c41d
diff --git a/tests/sepolicy_tests.py b/tests/sepolicy_tests.py
index 1df8231..af47938 100644
--- a/tests/sepolicy_tests.py
+++ b/tests/sepolicy_tests.py
@@ -299,24 +299,7 @@
else:
Option.take_action(self, action, dest, opt, value, values, parser)
-Tests = [
- "TestBpffsTypeViolations",
- "TestDataTypeViolators",
- "TestProcTypeViolations",
- "TestSysfsTypeViolations",
- "TestSystemTypeViolators",
- "TestDebugfsTypeViolations",
- "TestTracefsTypeViolations",
- "TestVendorTypeViolations",
- "TestCoreDataTypeViolations",
- "TestPropertyTypeViolations",
- "TestAppDataTypeViolations",
- "TestDmaHeapDevTypeViolations",
- "TestCoredomainViolations",
- "TestViolatorAttributes",
- "TestIsolatedAttributeConsistency",
- "TestDevTypeViolations",
-]
+TEST_NAMES = [ name for name in dir() if name.startswith('Test') ]
def do_main(libpath):
"""
@@ -330,7 +313,7 @@
metavar="FILE", action="extend", type="string")
parser.add_option("-p", "--policy", dest="policy", metavar="FILE")
parser.add_option("-t", "--test", dest="test", action="extend",
- help="Test options include "+str(Tests))
+ help="Test options include "+str(TEST_NAMES))
(options, args) = parser.parse_args()