3 # SPDX-License-Identifier: BSD-3-Clause
4 # Copyright(c) 2017 Intel Corporation
6 from __future__ import print_function
13 from threading import Timer
16 print("ERROR: Test app timed out")
19 if sys.version_info.major < 3:
20 print("WARNING: Python 2 is deprecated for use in DPDK, and will not work in future releases.", file=sys.stderr)
21 print("Please use Python 3 instead", file=sys.stderr)
26 parser = argparse.ArgumentParser(
27 description='BBdev Unit Test Application',
28 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
29 parser.add_argument("-p", "--testapp-path",
30 help="specifies path to the bbdev test app",
31 default=dpdk_path + "/" + dpdk_target + "/app/dpdk-test-bbdev")
32 parser.add_argument("-e", "--eal-params",
33 help="EAL arguments which are passed to the test app",
34 default="--vdev=baseband_null0")
35 parser.add_argument("-t", "--timeout",
37 help="Timeout in seconds",
39 parser.add_argument("-c", "--test-cases",
41 help="Defines test cases to run. Run all if not specified")
42 parser.add_argument("-v", "--test-vector",
44 help="Specifies paths to the test vector files.",
46 "/app/test-bbdev/test_vectors/bbdev_null.data"])
47 parser.add_argument("-n", "--num-ops",
49 help="Number of operations to process on device.",
51 parser.add_argument("-b", "--burst-size",
54 help="Operations enqueue/dequeue burst size.",
56 parser.add_argument("-l", "--num-lcores",
58 help="Number of lcores to run.",
60 parser.add_argument("-i", "--init-device",
62 help="Initialise PF device with default values.")
64 args = parser.parse_args()
66 if not os.path.exists(args.testapp_path):
67 print("No such file: " + args.testapp_path)
70 params = [args.testapp_path]
72 params.extend(shlex.split(args.eal_params))
77 params.extend(["-n", str(args.num_ops)])
80 params.extend(["-l", str(args.num_lcores)])
84 params.extend([",".join(args.test_cases)])
91 for vector in args.test_vector:
92 for burst_size in args.burst_size:
93 call_params = params[:]
94 call_params.extend(["-v", vector])
95 call_params.extend(["-b", str(burst_size)])
96 params_string = " ".join(call_params)
98 print("Executing: {}".format(params_string))
99 app_proc = subprocess.Popen(call_params)
101 timer = Timer(args.timeout, kill, [app_proc])
105 app_proc.communicate()
107 print("Error: failed to execute: {}".format(params_string))
111 if app_proc.returncode != 0:
113 print("ERROR TestCase failed. Failed test for vector {}. Return code: {}".format(
114 vector, app_proc.returncode))
116 sys.exit(exit_status)