]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Register test cases automatically from test_p2p_*.py
authorJouni Malinen <j@w1.fi>
Sat, 9 Mar 2013 21:18:20 +0000 (23:18 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 9 Mar 2013 21:19:59 +0000 (23:19 +0200)
This removes need for editing run-p2p-tests.py whenever new test files
are added.

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

tests/hwsim/run-p2p-tests.py

index e8060b9461e52c86af40b6a8aa3870b0a88aeb9b..151c538d82bec8aa8abf4c19c7aa64df55f0defd 100755 (executable)
@@ -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 = []