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"
18 if "RTE_SDK" in os.environ:
19 dpdk_path = os.environ["RTE_SDK"]
23 if "RTE_TARGET" in os.environ:
24 dpdk_target = os.environ["RTE_TARGET"]
26 dpdk_target = "x86_64-native-linuxapp-gcc"
28 parser = argparse.ArgumentParser(
29 description='BBdev Unit Test Application',
30 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
31 parser.add_argument("-p", "--testapp-path",
32 help="specifies path to the bbdev test app",
33 default=dpdk_path + "/" + dpdk_target + "/app/testbbdev")
34 parser.add_argument("-e", "--eal-params",
35 help="EAL arguments which are passed to the test app",
36 default="--vdev=baseband_null0")
37 parser.add_argument("-t", "--timeout",
39 help="Timeout in seconds",
41 parser.add_argument("-c", "--test-cases",
43 help="Defines test cases to run. Run all if not specified")
44 parser.add_argument("-v", "--test-vector",
46 help="Specifies paths to the test vector files.",
48 "/app/test-bbdev/test_vectors/bbdev_null.data"])
49 parser.add_argument("-n", "--num-ops",
51 help="Number of operations to process on device.",
53 parser.add_argument("-b", "--burst-size",
56 help="Operations enqueue/dequeue burst size.",
58 parser.add_argument("-l", "--num-lcores",
60 help="Number of lcores to run.",
63 args = parser.parse_args()
65 if not os.path.exists(args.testapp_path):
66 print "No such file: " + args.testapp_path
69 params = [args.testapp_path]
71 params.extend(shlex.split(args.eal_params))
76 params.extend(["-n", str(args.num_ops)])
79 params.extend(["-l", str(args.num_lcores)])
83 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)