@@ -101,7 +101,7 @@ foreach app:apps
link_libs = dpdk_static_libraries + dpdk_drivers
endif
- executable('dpdk-' + name,
+ exec = executable('dpdk-' + name,
sources,
c_args: cflags,
link_args: ldflags,
@@ -110,4 +110,9 @@ foreach app:apps
include_directories: includes,
install_rpath: join_paths(get_option('prefix'), driver_install_path),
install: true)
+ if name == 'test'
+ dpdk_test = exec
+ autotest_sources = sources
+ subdir('test/suites') # define the pre-canned test suites
+ endif
endforeach
new file mode 100644
@@ -0,0 +1,76 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2023 Intel Corporation
+
+# some perf tests (eg: memcpy perf autotest)take very long
+# to complete, so timeout to 10 minutes
+timeout_seconds = 600
+timeout_seconds_fast = 10
+
+test_no_huge_args = ['--no-huge', '-m', '2048']
+has_hugepage = run_command(has_hugepages_cmd, check: true).stdout().strip() != '0'
+message('hugepage availability: @0@'.format(has_hugepage))
+
+# process source files to determine the different unit test suites
+# - fast_tests
+# - perf_tests
+# - driver_tests
+test_suites = run_command(get_test_suites_cmd, autotest_sources,
+ check: true).stdout().strip().split()
+foreach suite:test_suites
+ # simple cases - tests without parameters or special handling
+ suite = suite.split('=')
+ suite_name = suite[0]
+ suite_tests = suite[1].split(',')
+ if suite_name != 'fast-tests'
+ # simple cases - tests without parameters or special handling
+ foreach t: suite_tests
+ test(t, dpdk_test,
+ args: ['--', t],
+ timeout: timeout_seconds,
+ is_parallel: false,
+ suite: suite_name)
+ endforeach
+ else
+ # special fast-test handling here
+ foreach t: suite_tests
+ params = t.split(':')
+ test_name = params[0]
+ nohuge = params[1] == 'true'
+ asan = params[2] == 'true'
+
+ test_args = []
+ if nohuge
+ test_args += test_no_huge_args
+ elif not has_hugepage
+ continue #skip this tests
+ endif
+ if not asan and (get_option('b_sanitize') == 'address'
+ or get_option('b_sanitize') == 'address,undefined')
+ continue # skip this test
+ endif
+
+ if (get_option('default_library') == 'shared'
+ and test_name == 'event_eth_tx_adapter_autotest')
+ test_args += ['-d', dpdk_drivers_build_dir]
+ endif
+ if is_linux
+ test_args += ['--file-prefix=@0@'.format(arg[0])]
+ endif
+
+ test(test_name, dpdk_test,
+ args : test_args + ['--', test_name],
+ timeout : timeout_seconds_fast,
+ is_parallel : false,
+ suite : 'fast-tests')
+ if not is_windows and test_name == 'trace_autotest'
+ test_args += ['--trace=.*']
+ test_args += ['--trace-dir=@0@'.format(meson.current_build_dir())]
+ test(test_name + '_with_traces', dpdk_test,
+ args : test_args + ['--', test_name],
+ timeout : timeout_seconds_fast,
+ is_parallel : false,
+ suite : 'fast-tests')
+ endif
+ endforeach
+ endif
+endforeach
new file mode 100644
@@ -0,0 +1,33 @@
+#! /usr/bin/env python3
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2023 Intel Corporation
+
+import sys
+import re
+
+input_list = sys.argv[1:]
+test_def_regex = re.compile("REGISTER_([A-Z]+)_TEST\s*\(\s*([a-z0-9_]+)")
+test_suites = {}
+
+def get_fast_test_params(test_name, ln):
+ "Extract the extra fast-test parameters from the line"
+ #print(f"ln: {ln.rstrip()}, test_name: {test_name}, split: {ln.split(test_name, 1)}")
+ (_, rest_of_line) = ln.split(test_name, 1)
+ (_, nohuge, asan, _func) = rest_of_line.split(',', 3)
+ return f":{nohuge.strip().lower()}:{asan.strip().lower()}"
+
+for fname in input_list:
+ with open(fname) as f:
+ contents = [ln for ln in f.readlines() if test_def_regex.match(ln.strip())]
+ for ln in contents:
+ (test_suite, test_name) = test_def_regex.match(ln).group(1, 2)
+ suite_name = f"{test_suite.lower()}-tests"
+ if suite_name in test_suites:
+ test_suites[suite_name].append(test_name)
+ else:
+ test_suites[suite_name] = [test_name]
+ if suite_name == "fast-tests":
+ test_suites["fast-tests"][-1] += get_fast_test_params(test_name, ln)
+
+for suite in test_suites.keys():
+ print(f"{suite}={','.join(test_suites[suite])}")
similarity index 100%
rename from app/test/has_hugepage.py
rename to buildtools/has-hugepages.py
@@ -18,6 +18,8 @@ map_to_win_cmd = py3 + files('map_to_win.py')
sphinx_wrapper = py3 + files('call-sphinx-build.py')
get_cpu_count_cmd = py3 + files('get-cpu-count.py')
get_numa_count_cmd = py3 + files('get-numa-count.py')
+get_test_suites_cmd = py3 + files('get-test-suites.py')
+has_hugepages_cmd = py3 + files('has-hugepages.py')
binutils_avx512_check = (py3 + files('binutils-avx512-check.py') +
[objdump] + cc.cmd_array())