]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: remote: Allow shuffle
authorJanusz Dziedzic <janusz.dziedzic@gmail.com>
Sun, 10 Jan 2021 15:50:48 +0000 (16:50 +0100)
committerJouni Malinen <j@w1.fi>
Fri, 15 Jan 2021 10:17:05 +0000 (12:17 +0200)
With -S option we will run tests in random order.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
tests/remote/run-tests.py

index e26e3483ae9aba627627e95538fda42a5852f770..67993a3c2a3427793cc9feaa406ebc49226467a3 100755 (executable)
@@ -13,6 +13,7 @@ import time
 import traceback
 import getopt
 from datetime import datetime
+from random import shuffle
 
 import logging
 logger = logging.getLogger()
@@ -32,7 +33,7 @@ from hwsim_wrapper import run_hwsim_test
 def usage():
     print("USAGE: " + sys.argv[0] + " -t devices")
     print("USAGE: " + sys.argv[0] + " -t check_devices")
-    print("USAGE: " + sys.argv[0] + " -d <dut_name> -t <all|sanity|tests_to_run> [-r <ref_name>] [-c <cfg_file.py>] [-m <all|monitor_name>] [-h hwsim_tests] [-f hwsim_modules][-R][-T][-P][-v]")
+    print("USAGE: " + sys.argv[0] + " -d <dut_name> -t <all|sanity|tests_to_run> [-r <ref_name>] [-c <cfg_file.py>] [-m <all|monitor_name>] [-h hwsim_tests] [-f hwsim_modules][-R][-T][-P][-S][-v]")
     print("USAGE: " + sys.argv[0])
 
 def get_devices(devices, duts, refs, monitors):
@@ -79,10 +80,11 @@ def main():
     trace = False
     restart = False
     perf = False
+    shuffle_tests = False
 
     # parse input parameters
     try:
-        opts, args = getopt.getopt(sys.argv[1:], "d:f:r:t:l:k:c:m:h:vRPT",
+        opts, args = getopt.getopt(sys.argv[1:], "d:f:r:t:l:k:c:m:h:vRPTS",
                                    ["dut=", "modules=", "ref=", "tests=",
                                     "log-dir=",
                                     "cfg=", "key=", "monitor=", "hwsim="])
@@ -100,6 +102,8 @@ def main():
             trace = True
         elif option == "-P":
             perf = True
+        elif option == "-S":
+            shuffle_tests = True
         elif option in ("-d", "--dut"):
             duts.append(argument)
         elif option in ("-r", "--ref"):
@@ -283,6 +287,10 @@ def main():
                 continue
             tests_to_run.append(t)
 
+    if shuffle_tests:
+        shuffle(tests_to_run)
+        shuffle(hwsim_tests_to_run)
+
     # lock devices
     try:
         get_devices(devices, duts, refs, monitors)