3 # SPDX-License-Identifier: BSD-3-Clause
4 # Copyright(c) 2017 Intel Corporation
12 from threading import Timer
15 print("ERROR: Test app timed out")
21 parser = argparse.ArgumentParser(
22 description='BBdev Unit Test Application',
23 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
24 parser.add_argument("-p", "--testapp-path",
25 help="specifies path to the bbdev test app",
26 default=dpdk_path + "/" + dpdk_target + "/app/dpdk-test-bbdev")
27 parser.add_argument("-e", "--eal-params",
28 help="EAL arguments which are passed to the test app",
29 default="--vdev=baseband_null0")
30 parser.add_argument("-t", "--timeout",
32 help="Timeout in seconds",
34 parser.add_argument("-c", "--test-cases",
36 help="Defines test cases to run. Run all if not specified")
37 parser.add_argument("-v", "--test-vector",
39 help="Specifies paths to the test vector files.",
41 "/app/test-bbdev/test_vectors/bbdev_null.data"])
42 parser.add_argument("-n", "--num-ops",
44 help="Number of operations to process on device.",
46 parser.add_argument("-b", "--burst-size",
49 help="Operations enqueue/dequeue burst size.",
51 parser.add_argument("-l", "--num-lcores",
53 help="Number of lcores to run.",
55 parser.add_argument("-i", "--init-device",
57 help="Initialise PF device with default values.")
59 args = parser.parse_args()
61 if not os.path.exists(args.testapp_path):
62 print("No such file: " + args.testapp_path)
65 params = [args.testapp_path]
67 params.extend(shlex.split(args.eal_params))
72 params.extend(["-n", str(args.num_ops)])
75 params.extend(["-l", str(args.num_lcores)])
79 params.extend([",".join(args.test_cases)])
86 for vector in args.test_vector:
87 for burst_size in args.burst_size:
88 call_params = params[:]
89 call_params.extend(["-v", vector])
90 call_params.extend(["-b", str(burst_size)])
91 params_string = " ".join(call_params)
93 print("Executing: {}".format(params_string))
94 app_proc = subprocess.Popen(call_params)
96 timer = Timer(args.timeout, kill, [app_proc])
100 app_proc.communicate()
102 print("Error: failed to execute: {}".format(params_string))
106 if app_proc.returncode != 0:
108 print("ERROR TestCase failed. Failed test for vector {}. Return code: {}".format(
109 vector, app_proc.returncode))
111 sys.exit(exit_status)