Pierrick Bouvier <[email protected]> writes:

> On 6/24/2026 8:06 AM, Alex Bennée wrote:
>> Pierrick Bouvier <[email protected]> writes:
>> 
>>> We add possibility to duplicate a test executable for a given source
>>> file. This is needed when different cflags need to be used (like
>>> vectorized vs non-vectorized for instance, like sve tests in aarch64).
>>>
>>> Signed-off-by: Pierrick Bouvier <[email protected]>
>>> ---
>>>  tests/tcg/meson.build | 17 +++++++++++++++--
>>>  1 file changed, 15 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
>>> index 72d1a9f8986..2c6d85c586a 100644
>>> --- a/tests/tcg/meson.build
>>> +++ b/tests/tcg/meson.build
>>> @@ -11,6 +11,7 @@ tcg_tests = {}
>>>  #     'tests': [
>>>  #       {
>>>  #         'src_file': {
>>> +#           'exe_name': ['provide an alternative binary name'],
>>>  #         }
>>>  #       },
>>>  #       ...
>>> @@ -18,10 +19,10 @@ tcg_tests = {}
>>>  #   }
>>>  # }
>>>  #
>>> -# Every test executable, is built only once.
>>> +# 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.
>>> +# Default name is derived from src if 'exe_name' is omitted.
>>>  
>>>  # plugins come first, as we need to build the list
>>>  subdir('plugins')
>>> @@ -47,11 +48,23 @@ foreach target, plan: tcg_tests
>>>  
>>>    foreach t : tests
>>>      foreach src, setup: t
>>> +      # return a clear error if user mispell a setup entry
>>> +      foreach key, _ : setup
>>> +        if key not in [
>>> +                       'exe_name',
>>> +                       ]
>>> +          error('unknown tcg setup entry \'' + key + '\' for test ' + src)
>>> +        endif
>>> +      endforeach
>>> +
>>>        # meson '/' operator drops left operand if right is an absolute path
>>>        src = folder / src
>>>        file = files(src)
>>>        test = fs.name(file)
>>>        exe_name = fs.stem(src)
>>> +      if 'exe_name' in setup
>>> +        exe_name = setup['exe_name']
>>> +      endif
>>>
>> 
>> Would it be better to put exe_name = fs.stem(src) in an else leg?
>>
>
> The rest of the file follow the pattern
> var = default
> if (different)
>   var = other
>
> So better to stick with one pattern for consistency.

Sure - but the other meson files seem to follow the other pattern, e.g.: 

if cpu not in supported_cpus
  host_arch = 'unknown'
else
  host_arch = cpu
endif


> It absolutely does not matter for "performance".
>
>> Anyway:
>> 
>> Reviewed-by: Alex Bennée <[email protected]>
>> 
>> 
>>>        exe_name = target + '-' + exe_name
>>>        test_name = exe_name
>> 

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro

Reply via email to