[PATCH v4 29A/29] tests/remote: add key filter to tests we should run

Janusz Dziedzic janusz.dziedzic at tieto.com
Fri Feb 26 04:52:07 PST 2016


Add -k (--key=) support. This base on regular expression.
So we can run tests based on the filter.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 tests/remote/run-tests.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/tests/remote/run-tests.py b/tests/remote/run-tests.py
index 61e7f3f..927bed0 100755
--- a/tests/remote/run-tests.py
+++ b/tests/remote/run-tests.py
@@ -71,8 +71,10 @@ def main():
     dut = None
     ref = None
     requested_tests = ["help"]
+    filtered_tests = []
     log_dir = "./logs/"
     verbose = False
+    filter_key = None
 
     # get env configuration
     setup_params = config.get_setup_params()
@@ -80,7 +82,7 @@ def main():
 
     # parse input parameters
     try:
-        opts, args = getopt.getopt(sys.argv[1:], "d:r:t:l:v", ["dut=", "ref=", "tests=", "log_dir="])
+        opts, args = getopt.getopt(sys.argv[1:], "d:r:t:l:k:v", ["dut=", "ref=", "tests=", "log_dir=", "key="])
     except getopt.GetoptError as err:
         print(err)
         usage()
@@ -97,6 +99,8 @@ def main():
             requested_tests = re.split('; | |, ', argument)
         elif option in ("-l", "--log_dir"):
             log_dir = argument
+        elif option in ("-k", "--key"):
+            filter_key = argument
         else:
             assert False, "unhandled option"
 
@@ -161,6 +165,13 @@ def main():
         show_devices(devices, setup_params)
         return
 
+    # filter
+    if filter_key:
+        for test in tests:
+            if re.search(filter_key, test.__name__):
+                filtered_tests.append(test)
+        tests = filtered_tests
+
     # setup test we should run
     tests_to_run = []
     if requested_tests[0] == "all":
-- 
1.9.1




More information about the Hostap mailing list