[PATCH 3/3] tests: remote: allow shuffle

Janusz Dziedzic janusz.dziedzic at gmail.com
Sun Jan 10 10:50:48 EST 2021


With -S option we will run tests in
random order.

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

diff --git a/tests/remote/run-tests.py b/tests/remote/run-tests.py
index e26e3483a..67993a3c2 100755
--- a/tests/remote/run-tests.py
+++ b/tests/remote/run-tests.py
@@ -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)
-- 
2.25.1




More information about the Hostap mailing list