Browse Source

tests: Allow selected tests to be specified

Command line parameter to run-p2p-tests.py can now be used to select
which test case is run instead of always running all test cases.

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

+ 11 - 0
tests/hwsim/run-p2p-tests.py

@@ -17,13 +17,21 @@ from wpasupplicant import WpaSupplicant
 import test_p2p_grpform
 import test_p2p_grpform
 
 
 def main():
 def main():
+    idx = 1
     if len(sys.argv) > 1 and sys.argv[1] == '-d':
     if len(sys.argv) > 1 and sys.argv[1] == '-d':
         logging.basicConfig(level=logging.DEBUG)
         logging.basicConfig(level=logging.DEBUG)
+        idx = idx + 1
     elif len(sys.argv) > 1 and sys.argv[1] == '-q':
     elif len(sys.argv) > 1 and sys.argv[1] == '-q':
         logging.basicConfig(level=logging.WARNING)
         logging.basicConfig(level=logging.WARNING)
+        idx = idx + 1
     else:
     else:
         logging.basicConfig(level=logging.INFO)
         logging.basicConfig(level=logging.INFO)
 
 
+    if len(sys.argv) > idx:
+        test_filter = sys.argv[idx]
+    else:
+        test_filter = None
+
     dev0 = WpaSupplicant('wlan0')
     dev0 = WpaSupplicant('wlan0')
     dev1 = WpaSupplicant('wlan1')
     dev1 = WpaSupplicant('wlan1')
     dev2 = WpaSupplicant('wlan2')
     dev2 = WpaSupplicant('wlan2')
@@ -43,6 +51,9 @@ def main():
     failed = []
     failed = []
 
 
     for t in tests:
     for t in tests:
+        if test_filter:
+            if test_filter not in t.__name__:
+                continue
         print "START " + t.__name__
         print "START " + t.__name__
         for d in dev:
         for d in dev:
             d.request("NOTE TEST-START " + t.__name__)
             d.request("NOTE TEST-START " + t.__name__)