We add possibility to duplicate a test for a given src. This allows to declare several tests that still share the same executable, thus saving space and compile time.
A side note to mention that meson perfectly supports declaring several tests with the same name. However, we prevent that to force dev to clarify what is the intent of each individual test. Reviewed-by: Manos Pitsidianakis <[email protected]> Tested-by: Alex Bennée <[email protected]> Signed-off-by: Pierrick Bouvier <[email protected]> --- tests/tcg/meson.build | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build index 697b826a382..ae7ec998f63 100644 --- a/tests/tcg/meson.build +++ b/tests/tcg/meson.build @@ -12,6 +12,7 @@ tcg_tests = {} # { # 'src_file': { # 'exe_name': ['provide an alternative binary name'], +# 'test_name': ['provide an alternative test name'], # } # }, # ... @@ -21,8 +22,9 @@ tcg_tests = {} # # Every test executable, identified by 'exe_name' is built only once. # Tests for a given src use the same executable by default, and their definition -# is guaranteed to be unique also. -# Default name is derived from src if 'exe_name' is omitted. +# is guaranteed to be unique also. Several tests for the same executable can +# declared using 'test_name'. +# Default name is derived from src if 'exe_name' and 'test_name' are omitted. # plugins come first, as we need to build the list subdir('plugins') @@ -52,7 +54,7 @@ foreach target, plan: tcg_tests foreach src, setup: t # return a clear error if user misspell a setup entry foreach key, _ : setup - allowed = ['exe_name'] + allowed = ['exe_name', 'test_name'] if key not in allowed error('unknown tcg setup entry \'' + key + '\' for test ' + src + ' (possible: [' + ', '.join(allowed) + '])') @@ -67,8 +69,13 @@ foreach target, plan: tcg_tests exe_name = setup['exe_name'] endif - exe_name = target + '-' + exe_name test_name = exe_name + if 'test_name' in setup + test_name = setup['test_name'] + endif + + exe_name = target + '-' + exe_name + test_name = target + '-' + test_name if test_name in added_tests error('test ' + test_name + ' was already added: ' + -- 2.47.3
