Manos Pitsidianakis <[email protected]> writes:
> On Wed, 10 Jun 2026 00:47, Pierrick Bouvier
> <[email protected]> wrote:
>>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.
>>
>>Signed-off-by: Pierrick Bouvier <[email protected]>
>>---
>> tests/tcg/meson.build | 14 ++++++++++----
>> 1 file changed, 10 insertions(+), 4 deletions(-)
>>
>>diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
>>index 2c6d85c586a..bb0184732fd 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,8 @@ 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. They can be duplicated by setting
>>'test_name'.
>
> While it's clear in the patch description, it might be a good idea to
> explain that "duplication" means using the same executable here, for
> clarity, if you respin this series.
additional versions of the test can be added by setting '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')
>>@@ -51,7 +52,7 @@ foreach target, plan: tcg_tests
>> # return a clear error if user mispell a setup entry
>> foreach key, _ : setup
>> if key not in [
>>- 'exe_name',
>>+ 'exe_name', 'test_name',
>> ]
>> error('unknown tcg setup entry \'' + key + '\' for test ' + src)
>
>
> Unrelated to this patch, but you could refactor the ['exe_name',
> 'test_name'] etc key set outside and print the list of valid keys in
> the error message as well for UX.
>
>> endif
>>@@ -66,8 +67,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.43.0
>>
>
>
> LGTM (feel free to ignore the comments)
>
> Reviewed-by: Manos Pitsidianakis <[email protected]>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro