tests: remote: Allow shuffle

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

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
This commit is contained in:
Janusz Dziedzic 2021-01-10 16:50:48 +01:00 committed by Jouni Malinen
parent 3c6468a7f3
commit cb9cc66b35

View file

@ -13,6 +13,7 @@ import time
import traceback import traceback
import getopt import getopt
from datetime import datetime from datetime import datetime
from random import shuffle
import logging import logging
logger = logging.getLogger() logger = logging.getLogger()
@ -32,7 +33,7 @@ from hwsim_wrapper import run_hwsim_test
def usage(): def usage():
print("USAGE: " + sys.argv[0] + " -t devices") print("USAGE: " + sys.argv[0] + " -t devices")
print("USAGE: " + sys.argv[0] + " -t check_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]) print("USAGE: " + sys.argv[0])
def get_devices(devices, duts, refs, monitors): def get_devices(devices, duts, refs, monitors):
@ -79,10 +80,11 @@ def main():
trace = False trace = False
restart = False restart = False
perf = False perf = False
shuffle_tests = False
# parse input parameters # parse input parameters
try: 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=", ["dut=", "modules=", "ref=", "tests=",
"log-dir=", "log-dir=",
"cfg=", "key=", "monitor=", "hwsim="]) "cfg=", "key=", "monitor=", "hwsim="])
@ -100,6 +102,8 @@ def main():
trace = True trace = True
elif option == "-P": elif option == "-P":
perf = True perf = True
elif option == "-S":
shuffle_tests = True
elif option in ("-d", "--dut"): elif option in ("-d", "--dut"):
duts.append(argument) duts.append(argument)
elif option in ("-r", "--ref"): elif option in ("-r", "--ref"):
@ -283,6 +287,10 @@ def main():
continue continue
tests_to_run.append(t) tests_to_run.append(t)
if shuffle_tests:
shuffle(tests_to_run)
shuffle(hwsim_tests_to_run)
# lock devices # lock devices
try: try:
get_devices(devices, duts, refs, monitors) get_devices(devices, duts, refs, monitors)