tests: run-tests.py -L to print out list of test cases
authorJouni Malinen <j@w1.fi>
Sun, 29 Sep 2013 13:11:48 +0000 (16:11 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 29 Sep 2013 13:11:48 +0000 (16:11 +0300)
This can be used to get a summary of all the available test cases.

Signed-hostap: Jouni Malinen <j@w1.fi>

tests/hwsim/run-tests.py

index b748fd9..38efda0 100755 (executable)
@@ -63,6 +63,24 @@ def main():
         else:
             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:
         test_filter = sys.argv[idx]
     else:
@@ -84,19 +102,6 @@ def main():
     for ap in apdev:
         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 = []
     failed = []