Browse Source

tests: Register test cases automatically from test_p2p_*.py

This removes need for editing run-p2p-tests.py whenever new test files
are added.

Signed-hostap: Jouni Malinen <j@w1.fi>
Jouni Malinen 12 years ago
parent
commit
2a4291ffdc
1 changed files with 7 additions and 5 deletions
  1. 7 5
      tests/hwsim/run-p2p-tests.py

+ 7 - 5
tests/hwsim/run-p2p-tests.py

@@ -7,6 +7,7 @@
 # See README for more details.
 
 import os
+import re
 import sys
 import time
 
@@ -14,9 +15,6 @@ import logging
 
 from wpasupplicant import WpaSupplicant
 
-import test_p2p_grpform
-import test_p2p_autogo
-
 def main():
     idx = 1
     if len(sys.argv) > 1 and sys.argv[1] == '-d':
@@ -46,8 +44,12 @@ def main():
         print "DEV: " + d.ifname + ": " + d.p2p_dev_addr()
 
     tests = []
-    test_p2p_grpform.add_tests(tests)
-    test_p2p_autogo.add_tests(tests)
+    for t in os.listdir("."):
+        m = re.match(r'(test_p2p_.*)\.py$', t)
+        if m:
+            print "Import test cases from " + t
+            mod = __import__(m.group(1))
+            mod.add_tests(tests)
 
     passed = []
     failed = []