On 6/24/2026 7:54 AM, Alex Bennée wrote:
> Pierrick Bouvier <[email protected]> writes:
> 
>> Every target declare its tests, and add them in global tcg_tests
>> dictionary, indexed by target name. See comment for full description.
>>
>> We make sure that if a user repeats a test several time it won't result
>> in duplicated executables or tests. In next commits, we'll introduce
>> what's needed to deal with that.
>>
>> A test is compiled from a single source file (and later, a single set of
>> compile flags). We make sure dependencies are correctly handled by
>> generating a depfile.
>>
>> Signed-off-by: Pierrick Bouvier <[email protected]>
>> ---
>>  tests/meson.build     |  2 +-
>>  tests/tcg/meson.build | 94 +++++++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 95 insertions(+), 1 deletion(-)
>>  create mode 100644 tests/tcg/meson.build
>>
>> diff --git a/tests/meson.build b/tests/meson.build
>> index 9ba04bbedd3..5877d2f60b1 100644
> <snip>
>> +
>> +      # build executable if needed
>> +      if exe_name not in built_tests
>> +        exe = custom_target(exe_name,
>> +                            input: file,
>> +                            command: [cc, '@INPUT@',
>> +                                      '-o', '@OUTPUT@', '-static',
>> +                                      '-MMD', '-MF', '@DEPFILE@',
>> +                                      '-Wall', '-Werror',
>> +                                      '-O0', '-g', '-fno-strict-aliasing',
>> +                                      ],
>> +                            depfile: exe_name + '.d',
>> +                            output: exe_name + '.test',
>> +                            build_by_default: false)
>> +        built_tests += {exe_name: exe}
>> +      endif
> 
> I noticed:
> 
>   ninja -v tests/tcg/aarch64-linux-user-sve-str.test
>   [1/1] /usr/lib/ccache/aarch64-linux-gnu-gcc 
> ../../tests/tcg/aarch64/sve-str.c -o 
> tests/tcg/aarch64-linux-user-sve-str.test -static -MMD -MF 
> tests/tcg/aarch64-linux-user-sve-str.d -Wall -Werror -O0 -g 
> -fno-strict-aliasing -march=armv8.1-a+sve -O1
> 
> and as the compiler parses the command line left to right it does the
> right thing, but perhaps a comment here to point out additional flags
> can be added.
>

This should be more clear after reading patch 7 which adds cflags at the
end of command line, as expected.

> Otherwise with your other fixes:
> 
> Reviewed-by: Alex Bennée <[email protected]>
> 
> 
>> +
>> +      depends = []
>> +
>> +      exe = built_tests[exe_name]
>> +      cmd = [qemu, exe]
>> +
>> +      # some tests expect QEMU env var to be set
>> +      cmd = ['QEMU=' + qemu.full_path(), cmd]
>> +
>> +      test(test_name, env, args: cmd,
>> +           depends: depends,
>> +           suite: ['tcg', 'tcg-' + target])
>> +      added_tests += {test_name: true}
>> +    endforeach
>> +  endforeach
>> +endforeach
> 


Reply via email to