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)
23 if "RTE_SDK" in os.environ:
24 dpdk_path = os.environ["RTE_SDK"]
28 if "RTE_TARGET" in os.environ:
29 dpdk_target = os.environ["RTE_TARGET"]
31 dpdk_target = "x86_64-native-linux-gcc"
33 parser = argparse.ArgumentParser(
34 description='BBdev Unit Test Application',
35 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
36 parser.add_argument("-p", "--testapp-path",
37 help="specifies path to the bbdev test app",
38 default=dpdk_path + "/" + dpdk_target + "/app/testbbdev")
39 parser.add_argument("-e", "--eal-params",
40 help="EAL arguments which are passed to the test app",
41 default="--vdev=baseband_null0")
42 parser.add_argument("-t", "--timeout",
44 help="Timeout in seconds",
46 parser.add_argument("-c", "--test-cases",
48 help="Defines test cases to run. Run all if not specified")
49 parser.add_argument("-v", "--test-vector",
51 help="Specifies paths to the test vector files.",
53 "/app/test-bbdev/test_vectors/bbdev_null.data"])
54 parser.add_argument("-n", "--num-ops",
56 help="Number of operations to process on device.",
58 parser.add_argument("-b", "--burst-size",
61 help="Operations enqueue/dequeue burst size.",
63 parser.add_argument("-l", "--num-lcores",
65 help="Number of lcores to run.",
67 parser.add_argument("-i", "--init-device",
69 help="Initialise PF device with default values.")
71 args = parser.parse_args()
73 if not os.path.exists(args.testapp_path):
74 print("No such file: " + args.testapp_path)
77 params = [args.testapp_path]
79 params.extend(shlex.split(args.eal_params))
84 params.extend(["-n", str(args.num_ops)])
87 params.extend(["-l", str(args.num_lcores)])
91 params.extend([",".join(args.test_cases)])
98 for vector in args.test_vector:
99 for burst_size in args.burst_size:
100 call_params = params[:]
101 call_params.extend(["-v", vector])
102 call_params.extend(["-b", str(burst_size)])
103 params_string = " ".join(call_params)
105 print("Executing: {}".format(params_string))
106 app_proc = subprocess.Popen(call_params)
108 timer = Timer(args.timeout, kill, [app_proc])
112 app_proc.communicate()
114 print("Error: failed to execute: {}".format(params_string))
118 if app_proc.returncode != 0:
120 print("ERROR TestCase failed. Failed test for vector {}. Return code: {}".format(
121 vector, app_proc.returncode))
123 sys.exit(exit_status)