On Mon, Jan 19, 2026 at 05:55:09PM -0800, Stephen Hemminger wrote:
> The trace_autotest_with_traces test needs a unique file-prefix to avoid
> collisions when running in parallel with other tests.
>
> Rather than duplicating test argument construction, restructure to add
> file-prefix as the last step. This allows reusing test_args for the
> trace variant by concatenating the trace-specific arguments and a
> different file-prefix at the end.
>
> Fixes: 0aeaf75df879 ("test: define unit tests suites based on test types")
> Cc: [email protected]
>
> Signed-off-by: Stephen Hemminger <[email protected]>
> ---
> app/test/suites/meson.build | 25 ++++++++++++++++---------
> 1 file changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/app/test/suites/meson.build b/app/test/suites/meson.build
> index 4c815ea097..fdc0b77149 100644
> --- a/app/test/suites/meson.build
> +++ b/app/test/suites/meson.build
> @@ -90,26 +90,33 @@ foreach suite:test_suites
> if not asan and get_option('b_sanitize').contains('address')
> continue # skip this test
> endif
> - if is_linux
> - # use unique file-prefix to allow parallel runs
> - test_args += ['--file-prefix=' + test_name.underscorify()]
> - endif
> -
> if get_option('default_library') == 'shared'
> test_args += ['-d', dpdk_drivers_build_dir]
> endif
>
> + # use unique file-prefix to allow parallel runs
> + if is_linux
> + file_prefix = ['--file-prefix=' + test_name.underscorify()]
> + else
> + file_prefix = []
> + endif
> +
I would test to shorten, and merge generating a trace prefix into this, to
avoid multiple if-else branches.:
file_prefix = []
trace_file_prefix = []
if is_linux
file_prefix = ['--file-prefix=' + test_name.underscorify()]
trace_file_prefix = [file_prefix[0] + '_with_traces']
endif
> test(test_name, dpdk_test,
> - args : test_args,
> + args : test_args + file_prefix,
> env: ['DPDK_TEST=' + 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())]
> + trace_extra = ['--trace=.*',
> +
> '--trace-dir=@0@'.format(meson.current_build_dir())]
> + if is_linux
> + trace_prefix =
> ['--file-prefix=trace_autotest_with_traces']
> + else
> + trace_prefix = []
> + endif
> test(test_name + '_with_traces', dpdk_test,
> - args : test_args,
> + args : test_args + trace_extra + trace_prefix,
> env: ['DPDK_TEST=' + test_name],
> timeout : timeout_seconds_fast,
> is_parallel : false,
> --
> 2.51.0
>