[dpdk-dev] [RFC 1/3] test/meson: auto detect number of cores
Aaron Conole
aconole at redhat.com
Fri Mar 29 18:22:39 CET 2019
Some environments do not provide a minimum 4 cores for running tests. This
allows those environments to still execute 'ninja test' without causing
multiple failures.
Signed-off-by: Aaron Conole <aconole at redhat.com>
---
app/test/meson.build | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/app/test/meson.build b/app/test/meson.build
index ddb4d09ae..975b38daa 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -337,10 +337,15 @@ if get_option('tests')
timeout_seconds = 600
timeout_seconds_fast = 10
+ # Retreive the number of CPU cores
+ num_cores = run_command('lscpu', '-p=cpu').stdout().strip().split('\n')[-1]
+ num_cores_arg = '-l 0-' + num_cores
+
+ test_args = [num_cores_arg, '-n 4']
foreach arg : fast_parallel_test_names
test(arg, dpdk_test,
env : ['DPDK_TEST=' + arg],
- args : ['-c f','-n 4', '--file-prefix=@0@'.format(arg)],
+ args : test_args + ['--file-prefix=@0@'.format(arg)],
timeout : timeout_seconds_fast,
suite : 'fast-tests')
endforeach
@@ -348,6 +353,7 @@ if get_option('tests')
foreach arg : fast_non_parallel_test_names
test(arg, dpdk_test,
env : ['DPDK_TEST=' + arg],
+ args : test_args + ['--file-prefix=@0@'.format(arg)],
timeout : timeout_seconds_fast,
is_parallel : false,
suite : 'fast-tests')
@@ -356,6 +362,7 @@ if get_option('tests')
foreach arg : perf_test_names
test(arg, dpdk_test,
env : ['DPDK_TEST=' + arg],
+ args : test_args + ['--file-prefix=@0@'.format(arg)],
timeout : timeout_seconds,
is_parallel : false,
suite : 'perf-tests')
@@ -364,6 +371,7 @@ if get_option('tests')
foreach arg : driver_test_names
test(arg, dpdk_test,
env : ['DPDK_TEST=' + arg],
+ args : test_args + ['--file-prefix=@0@'.format(arg)],
timeout : timeout_seconds,
is_parallel : false,
suite : 'driver-tests')
@@ -372,6 +380,7 @@ if get_option('tests')
foreach arg : dump_test_names
test(arg, dpdk_test,
env : ['DPDK_TEST=' + arg],
+ args : test_args + ['--file-prefix=@0@'.format(arg)],
timeout : timeout_seconds,
is_parallel : false,
suite : 'debug-tests')
--
2.19.1
More information about the dev
mailing list