tests: run-tests.py -L to print out list of test cases

This can be used to get a summary of all the available test cases.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-09-29 16:11:48 +03:00
parent 48d8a43a28
commit 9b00f24a76

View file

@ -63,6 +63,24 @@ def main():
else: else:
break break
tests = []
for t in os.listdir("."):
m = re.match(r'(test_.*)\.py$', t)
if m:
if test_file and test_file not in t:
continue
logger.debug("Import test cases from " + t)
mod = __import__(m.group(1))
for s in dir(mod):
if s.startswith("test_"):
func = mod.__dict__.get(s)
tests.append(func)
if len(sys.argv) > 1 and sys.argv[1] == '-L':
for t in tests:
print t.__name__ + " - " + t.__doc__
sys.exit(0)
if len(sys.argv) > idx: if len(sys.argv) > idx:
test_filter = sys.argv[idx] test_filter = sys.argv[idx]
else: else:
@ -84,19 +102,6 @@ def main():
for ap in apdev: for ap in apdev:
logger.info("APDEV: " + ap['ifname']) logger.info("APDEV: " + ap['ifname'])
tests = []
for t in os.listdir("."):
m = re.match(r'(test_.*)\.py$', t)
if m:
if test_file and test_file not in t:
continue
logger.debug("Import test cases from " + t)
mod = __import__(m.group(1))
for s in dir(mod):
if s.startswith("test_"):
func = mod.__dict__.get(s)
tests.append(func)
passed = [] passed = []
failed = [] failed = []