Browse Source

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>
Jouni Malinen 11 years ago
parent
commit
9b00f24a76
1 changed files with 18 additions and 13 deletions
  1. 18 13
      tests/hwsim/run-tests.py

+ 18 - 13
tests/hwsim/run-tests.py

@@ -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 = []