[PATCH 00/27] tests/tcg: run tests with meson

Pierrick Bouvier posted 27 patches 1 month, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260609214745.772536-1-pierrick.bouvier@oss.qualcomm.com
Maintainers: Peter Maydell <peter.maydell@linaro.org>, "Alex Bennée" <alex.bennee@linaro.org>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>, Alexandre Iooss <erdnaxe@crans.org>
There is a newer version of this series
tests/meson.build                             |   2 +-
tests/tcg/aarch64/meson.build                 | 248 ++++++++++++++++
tests/tcg/aarch64/system/meson.build          | 100 +++++++
tests/tcg/meson.build                         | 276 ++++++++++++++++++
tests/tcg/multiarch/Makefile.target           |   3 +-
tests/tcg/multiarch/meson.build               | 149 ++++++++++
.../multiarch/plugin/check-plugin-output.sh   |  36 ---
tests/tcg/multiarch/plugin/regex-compare.sh   |  28 ++
tests/tcg/multiarch/sha1.ref                  |   1 +
tests/tcg/multiarch/system/memory.c           |   3 +-
tests/tcg/multiarch/system/meson.build        |  53 ++++
tests/tcg/plugins/meson.build                 |  11 +-
tests/tcg/scripts/check_plugin_output.sh      |  19 ++
tests/tcg/scripts/record_replay.sh            |  16 +
.../scripts/run_and_check_forbidden_output.sh |  19 ++
tests/tcg/scripts/run_and_diff.sh             |  12 +
tests/tcg/scripts/run_with_input.sh           |  12 +
17 files changed, 943 insertions(+), 45 deletions(-)
create mode 100644 tests/tcg/aarch64/meson.build
create mode 100644 tests/tcg/aarch64/system/meson.build
create mode 100644 tests/tcg/meson.build
create mode 100644 tests/tcg/multiarch/meson.build
delete mode 100755 tests/tcg/multiarch/plugin/check-plugin-output.sh
create mode 100755 tests/tcg/multiarch/plugin/regex-compare.sh
create mode 100644 tests/tcg/multiarch/sha1.ref
create mode 100644 tests/tcg/multiarch/system/meson.build
create mode 100755 tests/tcg/scripts/check_plugin_output.sh
create mode 100755 tests/tcg/scripts/record_replay.sh
create mode 100755 tests/tcg/scripts/run_and_check_forbidden_output.sh
create mode 100755 tests/tcg/scripts/run_and_diff.sh
create mode 100755 tests/tcg/scripts/run_with_input.sh
[PATCH 00/27] tests/tcg: run tests with meson
Posted by Pierrick Bouvier 1 month, 2 weeks ago
This series is an experiment to replace TCG tests makefiles with meson, with the
goal of having something more readable and maintainable in the long term.
Also it closes the gap that tcg tests had with the rest of tests, by integrating
them with meson directly.

It covers all existing tests for aarch64 architecture, including
user/system/multiarch-user/multiarch-system. I'll carry the effort to port all
other architectures once we agree on a base. We agreed with Alex to not merge
anything before all arch are covered.

Series first declare the global infrastructure, then add aarch64 and multiarch
tests, and finally plugin tests.

For review, I would suggest to start with aarch64 patches (end of the series) to
get an idea of what they will look like, before the implementation itself. You
can also compare that to existing Makefiles, they follow the same order.

It implements all requirements listed on original thread [1], except cross
container support, which can be easily added on top once we agree on the base.
[1] https://lore.kernel.org/qemu-devel/87wlwfsay4.fsf@draig.linaro.org/

We also have for free:
- correct and complete dependencies for any test, including:
  scripts, c.inc, headers, reference files and binaries/plugins.
- catch test declaration issues at configure time vs test time.
- proper data types for variables instead of string expansion with make.
- we could now build tests binaries by default with 'all' target.
- hopefully, better readability to your taste.

Main ideas for the current design are:
- make arch files as simple and explicit as possible. If it conflicts,
  always pick explicit, as long as we don't expose meson details.
  remove any kind of "skip, override, filter" logic.
- never expose custom_target and meson details in arch files.
- catch any spelling mistake on test or any dependency.
- keep complexity contained in tests/tcg/meson.build.

Usage:

```
make check-tcg
make check-tcg-aarch64-linux-user
make check-tcg-aarch64-softmmu

from build folder:
./pyvenv/bin/meson test --list --suite tcg
ninja clean
./pyvenv/bin/meson test aarch64-softmmu-asid2 --verbose
```

Pierrick Bouvier (27):
  tests/tcg/multiarch/system/memory.c: remove unused variable
  tests/tcg/multiarch/plugin/check-plugin-output.sh: take test output as
    input
  tests/tcg/multiarch/plugin: rename check-plugin-output to
    regex-compare
  tests/tcg: introduce meson.build
  tests/tcg/meson.build: introduce exe_name
  tests/tcg/meson.build: introduce test_name
  tests/tcg/meson.build: introduce cflags
  tests/tcg/meson.build: introduce qemu_args
  tests/tcg/meson.build: introduce env_var
  tests/tcg/plugins: build list of test_plugins
  tests/tcg/meson.build: introduce plugin_test
  tests/tcg/meson.build: test gdb support and introduce gdb_arch
  tests/tcg/meson.build: introduce gdb_test
  tests/tcg/meson.build: add default flag for testing compiler support
  tests/tcg/meson.build: introduce wrapper
  tests/tcg/meson.build: introduce expected_output
  tests/tcg/meson.build: add wrapper run_and_check_forbidden_output
  tests/tcg/meson.build: add wrapper run_with_input
  tests/tcg/meson.build: add wrapper record_replay
  tests/tcg/meson.build: add wrapper check_plugin_output
  tests/tcg/aarch64: add user tests
  tests/tcg/aarch64: add system tests
  tests/tcg/multiarch: declare user tests
  tests/tcg/aarch64: add multiarch user tests
  tests/tcg/multiarch: declare system tests
  tests/tcg/aarch64: add multiarch system tests
  tests/tcg/meson.build: add generic plugin tests

 tests/meson.build                             |   2 +-
 tests/tcg/aarch64/meson.build                 | 248 ++++++++++++++++
 tests/tcg/aarch64/system/meson.build          | 100 +++++++
 tests/tcg/meson.build                         | 276 ++++++++++++++++++
 tests/tcg/multiarch/Makefile.target           |   3 +-
 tests/tcg/multiarch/meson.build               | 149 ++++++++++
 .../multiarch/plugin/check-plugin-output.sh   |  36 ---
 tests/tcg/multiarch/plugin/regex-compare.sh   |  28 ++
 tests/tcg/multiarch/sha1.ref                  |   1 +
 tests/tcg/multiarch/system/memory.c           |   3 +-
 tests/tcg/multiarch/system/meson.build        |  53 ++++
 tests/tcg/plugins/meson.build                 |  11 +-
 tests/tcg/scripts/check_plugin_output.sh      |  19 ++
 tests/tcg/scripts/record_replay.sh            |  16 +
 .../scripts/run_and_check_forbidden_output.sh |  19 ++
 tests/tcg/scripts/run_and_diff.sh             |  12 +
 tests/tcg/scripts/run_with_input.sh           |  12 +
 17 files changed, 943 insertions(+), 45 deletions(-)
 create mode 100644 tests/tcg/aarch64/meson.build
 create mode 100644 tests/tcg/aarch64/system/meson.build
 create mode 100644 tests/tcg/meson.build
 create mode 100644 tests/tcg/multiarch/meson.build
 delete mode 100755 tests/tcg/multiarch/plugin/check-plugin-output.sh
 create mode 100755 tests/tcg/multiarch/plugin/regex-compare.sh
 create mode 100644 tests/tcg/multiarch/sha1.ref
 create mode 100644 tests/tcg/multiarch/system/meson.build
 create mode 100755 tests/tcg/scripts/check_plugin_output.sh
 create mode 100755 tests/tcg/scripts/record_replay.sh
 create mode 100755 tests/tcg/scripts/run_and_check_forbidden_output.sh
 create mode 100755 tests/tcg/scripts/run_and_diff.sh
 create mode 100755 tests/tcg/scripts/run_with_input.sh

-- 
2.43.0
Re: [PATCH 00/27] tests/tcg: run tests with meson
Posted by Pierrick Bouvier 4 weeks, 1 day ago
On 6/9/2026 2:47 PM, Pierrick Bouvier wrote:
> This series is an experiment to replace TCG tests makefiles with meson, with the
> goal of having something more readable and maintainable in the long term.
> Also it closes the gap that tcg tests had with the rest of tests, by integrating
> them with meson directly.
> 
> It covers all existing tests for aarch64 architecture, including
> user/system/multiarch-user/multiarch-system. I'll carry the effort to port all
> other architectures once we agree on a base. We agreed with Alex to not merge
> anything before all arch are covered.
> 
> Series first declare the global infrastructure, then add aarch64 and multiarch
> tests, and finally plugin tests.
> 
> For review, I would suggest to start with aarch64 patches (end of the series) to
> get an idea of what they will look like, before the implementation itself. You
> can also compare that to existing Makefiles, they follow the same order.
> 
> It implements all requirements listed on original thread [1], except cross
> container support, which can be easily added on top once we agree on the base.
> [1] https://lore.kernel.org/qemu-devel/87wlwfsay4.fsf@draig.linaro.org/
> 
> We also have for free:
> - correct and complete dependencies for any test, including:
>   scripts, c.inc, headers, reference files and binaries/plugins.
> - catch test declaration issues at configure time vs test time.
> - proper data types for variables instead of string expansion with make.
> - we could now build tests binaries by default with 'all' target.
> - hopefully, better readability to your taste.
> 
> Main ideas for the current design are:
> - make arch files as simple and explicit as possible. If it conflicts,
>   always pick explicit, as long as we don't expose meson details.
>   remove any kind of "skip, override, filter" logic.
> - never expose custom_target and meson details in arch files.
> - catch any spelling mistake on test or any dependency.
> - keep complexity contained in tests/tcg/meson.build.
> 
> Usage:
> 
> ```
> make check-tcg
> make check-tcg-aarch64-linux-user
> make check-tcg-aarch64-softmmu
> 
> from build folder:
> ./pyvenv/bin/meson test --list --suite tcg
> ninja clean
> ./pyvenv/bin/meson test aarch64-softmmu-asid2 --verbose
> ```
> 
> Pierrick Bouvier (27):
>   tests/tcg/multiarch/system/memory.c: remove unused variable
>   tests/tcg/multiarch/plugin/check-plugin-output.sh: take test output as
>     input
>   tests/tcg/multiarch/plugin: rename check-plugin-output to
>     regex-compare
>   tests/tcg: introduce meson.build
>   tests/tcg/meson.build: introduce exe_name
>   tests/tcg/meson.build: introduce test_name
>   tests/tcg/meson.build: introduce cflags
>   tests/tcg/meson.build: introduce qemu_args
>   tests/tcg/meson.build: introduce env_var
>   tests/tcg/plugins: build list of test_plugins
>   tests/tcg/meson.build: introduce plugin_test
>   tests/tcg/meson.build: test gdb support and introduce gdb_arch
>   tests/tcg/meson.build: introduce gdb_test
>   tests/tcg/meson.build: add default flag for testing compiler support
>   tests/tcg/meson.build: introduce wrapper
>   tests/tcg/meson.build: introduce expected_output
>   tests/tcg/meson.build: add wrapper run_and_check_forbidden_output
>   tests/tcg/meson.build: add wrapper run_with_input
>   tests/tcg/meson.build: add wrapper record_replay
>   tests/tcg/meson.build: add wrapper check_plugin_output
>   tests/tcg/aarch64: add user tests
>   tests/tcg/aarch64: add system tests
>   tests/tcg/multiarch: declare user tests
>   tests/tcg/aarch64: add multiarch user tests
>   tests/tcg/multiarch: declare system tests
>   tests/tcg/aarch64: add multiarch system tests
>   tests/tcg/meson.build: add generic plugin tests
> 
>  tests/meson.build                             |   2 +-
>  tests/tcg/aarch64/meson.build                 | 248 ++++++++++++++++
>  tests/tcg/aarch64/system/meson.build          | 100 +++++++
>  tests/tcg/meson.build                         | 276 ++++++++++++++++++
>  tests/tcg/multiarch/Makefile.target           |   3 +-
>  tests/tcg/multiarch/meson.build               | 149 ++++++++++
>  .../multiarch/plugin/check-plugin-output.sh   |  36 ---
>  tests/tcg/multiarch/plugin/regex-compare.sh   |  28 ++
>  tests/tcg/multiarch/sha1.ref                  |   1 +
>  tests/tcg/multiarch/system/memory.c           |   3 +-
>  tests/tcg/multiarch/system/meson.build        |  53 ++++
>  tests/tcg/plugins/meson.build                 |  11 +-
>  tests/tcg/scripts/check_plugin_output.sh      |  19 ++
>  tests/tcg/scripts/record_replay.sh            |  16 +
>  .../scripts/run_and_check_forbidden_output.sh |  19 ++
>  tests/tcg/scripts/run_and_diff.sh             |  12 +
>  tests/tcg/scripts/run_with_input.sh           |  12 +
>  17 files changed, 943 insertions(+), 45 deletions(-)
>  create mode 100644 tests/tcg/aarch64/meson.build
>  create mode 100644 tests/tcg/aarch64/system/meson.build
>  create mode 100644 tests/tcg/meson.build
>  create mode 100644 tests/tcg/multiarch/meson.build
>  delete mode 100755 tests/tcg/multiarch/plugin/check-plugin-output.sh
>  create mode 100755 tests/tcg/multiarch/plugin/regex-compare.sh
>  create mode 100644 tests/tcg/multiarch/sha1.ref
>  create mode 100644 tests/tcg/multiarch/system/meson.build
>  create mode 100755 tests/tcg/scripts/check_plugin_output.sh
>  create mode 100755 tests/tcg/scripts/record_replay.sh
>  create mode 100755 tests/tcg/scripts/run_and_check_forbidden_output.sh
>  create mode 100755 tests/tcg/scripts/run_and_diff.sh
>  create mode 100755 tests/tcg/scripts/run_with_input.sh
> 

v2 sent, with container support:
https://lore.kernel.org/qemu-devel/20260626233918.158740-2-pierrick.bouvier@oss.qualcomm.com/T/#t

Regards,
Pierrick
Re: [PATCH 00/27] tests/tcg: run tests with meson
Posted by Paolo Bonzini 1 month, 2 weeks ago
On 6/9/26 23:47, Pierrick Bouvier wrote:
> This series is an experiment to replace TCG tests makefiles with meson, with the
> goal of having something more readable and maintainable in the long term.
> Also it closes the gap that tcg tests had with the rest of tests, by integrating
> them with meson directly.
> 
> It covers all existing tests for aarch64 architecture, including
> user/system/multiarch-user/multiarch-system. I'll carry the effort to port all
> other architectures once we agree on a base. We agreed with Alex to not merge
> anything before all arch are covered.
> 
> Series first declare the global infrastructure, then add aarch64 and multiarch
> tests, and finally plugin tests.
> 
> For review, I would suggest to start with aarch64 patches (end of the series) to
> get an idea of what they will look like, before the implementation itself. You
> can also compare that to existing Makefiles, they follow the same order.
> 
> It implements all requirements listed on original thread [1], except cross
> container support, which can be easily added on top once we agree on the base.
> [1] https://lore.kernel.org/qemu-devel/87wlwfsay4.fsf@draig.linaro.org/

> We also have for free:
> - correct and complete dependencies for any test, including:
>    scripts, c.inc, headers, reference files and binaries/plugins.
> - catch test declaration issues at configure time vs test time.
> - proper data types for variables instead of string expansion with make.
> - we could now build tests binaries by default with 'all' target.
> - hopefully, better readability to your taste.

Yes there is absolutely a readability improvement!  At most, one could 
say that it's not a very high bar. :)

Having to reinvent cross compilation (cc_has_feat, custom_targets for 
compilation) is not great and the only part I'm not super convinced 
about; I wonder what it would be like to make TCG tests their own 
standalone meson projects.  While the Makefiles are awful I do like 
being able to do "make -C tests/tcg/x86_64-softmmu", and in that respect 
this would be a half step backwards (and a big step forwards in many 
other respects, mind).

I can help with the integration of the individual test suites into 
tests/tcg/Makefile.include.

Paolo

> Main ideas for the current design are:
> - make arch files as simple and explicit as possible. If it conflicts,
>    always pick explicit, as long as we don't expose meson details.
>    remove any kind of "skip, override, filter" logic.
> - never expose custom_target and meson details in arch files.
> - catch any spelling mistake on test or any dependency.
> - keep complexity contained in tests/tcg/meson.build.
> 
> Usage:
> 
> ```
> make check-tcg
> make check-tcg-aarch64-linux-user
> make check-tcg-aarch64-softmmu
> 
> from build folder:
> ./pyvenv/bin/meson test --list --suite tcg
> ninja clean
> ./pyvenv/bin/meson test aarch64-softmmu-asid2 --verbose
> ```
> 
> Pierrick Bouvier (27):
>    tests/tcg/multiarch/system/memory.c: remove unused variable
>    tests/tcg/multiarch/plugin/check-plugin-output.sh: take test output as
>      input
>    tests/tcg/multiarch/plugin: rename check-plugin-output to
>      regex-compare
>    tests/tcg: introduce meson.build
>    tests/tcg/meson.build: introduce exe_name
>    tests/tcg/meson.build: introduce test_name
>    tests/tcg/meson.build: introduce cflags
>    tests/tcg/meson.build: introduce qemu_args
>    tests/tcg/meson.build: introduce env_var
>    tests/tcg/plugins: build list of test_plugins
>    tests/tcg/meson.build: introduce plugin_test
>    tests/tcg/meson.build: test gdb support and introduce gdb_arch
>    tests/tcg/meson.build: introduce gdb_test
>    tests/tcg/meson.build: add default flag for testing compiler support
>    tests/tcg/meson.build: introduce wrapper
>    tests/tcg/meson.build: introduce expected_output
>    tests/tcg/meson.build: add wrapper run_and_check_forbidden_output
>    tests/tcg/meson.build: add wrapper run_with_input
>    tests/tcg/meson.build: add wrapper record_replay
>    tests/tcg/meson.build: add wrapper check_plugin_output
>    tests/tcg/aarch64: add user tests
>    tests/tcg/aarch64: add system tests
>    tests/tcg/multiarch: declare user tests
>    tests/tcg/aarch64: add multiarch user tests
>    tests/tcg/multiarch: declare system tests
>    tests/tcg/aarch64: add multiarch system tests
>    tests/tcg/meson.build: add generic plugin tests
> 
>   tests/meson.build                             |   2 +-
>   tests/tcg/aarch64/meson.build                 | 248 ++++++++++++++++
>   tests/tcg/aarch64/system/meson.build          | 100 +++++++
>   tests/tcg/meson.build                         | 276 ++++++++++++++++++
>   tests/tcg/multiarch/Makefile.target           |   3 +-
>   tests/tcg/multiarch/meson.build               | 149 ++++++++++
>   .../multiarch/plugin/check-plugin-output.sh   |  36 ---
>   tests/tcg/multiarch/plugin/regex-compare.sh   |  28 ++
>   tests/tcg/multiarch/sha1.ref                  |   1 +
>   tests/tcg/multiarch/system/memory.c           |   3 +-
>   tests/tcg/multiarch/system/meson.build        |  53 ++++
>   tests/tcg/plugins/meson.build                 |  11 +-
>   tests/tcg/scripts/check_plugin_output.sh      |  19 ++
>   tests/tcg/scripts/record_replay.sh            |  16 +
>   .../scripts/run_and_check_forbidden_output.sh |  19 ++
>   tests/tcg/scripts/run_and_diff.sh             |  12 +
>   tests/tcg/scripts/run_with_input.sh           |  12 +
>   17 files changed, 943 insertions(+), 45 deletions(-)
>   create mode 100644 tests/tcg/aarch64/meson.build
>   create mode 100644 tests/tcg/aarch64/system/meson.build
>   create mode 100644 tests/tcg/meson.build
>   create mode 100644 tests/tcg/multiarch/meson.build
>   delete mode 100755 tests/tcg/multiarch/plugin/check-plugin-output.sh
>   create mode 100755 tests/tcg/multiarch/plugin/regex-compare.sh
>   create mode 100644 tests/tcg/multiarch/sha1.ref
>   create mode 100644 tests/tcg/multiarch/system/meson.build
>   create mode 100755 tests/tcg/scripts/check_plugin_output.sh
>   create mode 100755 tests/tcg/scripts/record_replay.sh
>   create mode 100755 tests/tcg/scripts/run_and_check_forbidden_output.sh
>   create mode 100755 tests/tcg/scripts/run_and_diff.sh
>   create mode 100755 tests/tcg/scripts/run_with_input.sh
>
Re: [PATCH 00/27] tests/tcg: run tests with meson
Posted by Pierrick Bouvier 1 month, 2 weeks ago
On 6/10/2026 2:17 AM, Paolo Bonzini wrote:
> On 6/9/26 23:47, Pierrick Bouvier wrote:
> 
>> We also have for free:
>> - correct and complete dependencies for any test, including:
>>    scripts, c.inc, headers, reference files and binaries/plugins.
>> - catch test declaration issues at configure time vs test time.
>> - proper data types for variables instead of string expansion with make.
>> - we could now build tests binaries by default with 'all' target.
>> - hopefully, better readability to your taste.
> 
> Yes there is absolutely a readability improvement!  At most, one could
> say that it's not a very high bar. :)
> 
> Having to reinvent cross compilation (cc_has_feat, custom_targets for
> compilation) is not great and the only part I'm not super convinced
> about; I wonder what it would be like to make TCG tests their own
> standalone meson projects.  While the Makefiles are awful I do like
> being able to do "make -C tests/tcg/x86_64-softmmu", and in that respect
> this would be a half step backwards (and a big step forwards in many
> other respects, mind).
>

Your idea is to have one project per target, and use meson cross compile
support for this?

`make check-tcg-aarch64-softmu` is supported out of the box with this
series, without having to write a single line of Makefile. You can still
do what you like: see cover letter usage, to run a suite or a single test.

I don't see rewriting the cc_feat part in meson directly as a problem to
be honest. Not all architectures needs to check specific feat (only
aarch64, arm, i386, ppc64 and s390x).

Also, calling:
  supported = run_command[cc, check_cflags, flags].returncode() == 0
vs
  cc.get_supported_arguments(flags)
is not really much more complex IMHO, and not a huge reinvention.

Also, the custom target is hidden inside tcg/tests/meson.build and not
exposed to arch files. Even if we had multiple projects, I would stick
to not exposing test() and executable() in arch files.

> I can help with the integration of the individual test suites into
> tests/tcg/Makefile.include.
>

I would expect this file to disappear completely, and to rely on make
check-tcg-arch-* targets at top level instead. Would that work for you?

> Paolo
>
Regards,
Pierrick

Re: [PATCH 00/27] tests/tcg: run tests with meson
Posted by Paolo Bonzini 1 month, 2 weeks ago
On Wed, Jun 10, 2026 at 7:01 PM Pierrick Bouvier
<pierrick.bouvier@oss.qualcomm.com> wrote:
> Your idea is to have one project per target, and use meson cross compile
> support for this?

Yes, that was the idea.

> `make check-tcg-aarch64-softmu` is supported out of the box with this
> series, without having to write a single line of Makefile. You can still
> do what you like: see cover letter usage, to run a suite or a single test.
> I don't see rewriting the cc_feat part in meson directly as a problem to
> be honest. Not all architectures needs to check specific feat (only
> aarch64, arm, i386, ppc64 and s390x).
>
> Also, calling:
>   supported = run_command[cc, check_cflags, flags].returncode() == 0
> vs
>   cc.get_supported_arguments(flags)
> is not really much more complex IMHO, and not a huge reinvention.
>
> Also, the custom target is hidden inside tcg/tests/meson.build and not
> exposed to arch files. Even if we had multiple projects, I would stick
> to not exposing test() and executable() in arch files.

Fair enough.

> I would expect this file to disappear completely, and to rely on make
> check-tcg-arch-* targets at top level instead. Would that work for you?

Yeah, you're right that at this point TCG tests are the last
stragglers in that file. That tilts the balance for me, it does make
sense to do this with custom_target() until Meson grows support for
something like multi-machine projects. Just please add an alias_target
'build-tcg-tests-...' for compatibility with tests/Makefile.include.

Paolo
Re: [PATCH 00/27] tests/tcg: run tests with meson
Posted by Pierrick Bouvier 1 month, 2 weeks ago
On 6/11/2026 7:49 AM, Paolo Bonzini wrote:
> On Wed, Jun 10, 2026 at 7:01 PM Pierrick Bouvier
> <pierrick.bouvier@oss.qualcomm.com> wrote:
>> Your idea is to have one project per target, and use meson cross compile
>> support for this?
> 
> Yes, that was the idea.
> 
>> `make check-tcg-aarch64-softmu` is supported out of the box with this
>> series, without having to write a single line of Makefile. You can still
>> do what you like: see cover letter usage, to run a suite or a single test.
>> I don't see rewriting the cc_feat part in meson directly as a problem to
>> be honest. Not all architectures needs to check specific feat (only
>> aarch64, arm, i386, ppc64 and s390x).
>>
>> Also, calling:
>>   supported = run_command[cc, check_cflags, flags].returncode() == 0
>> vs
>>   cc.get_supported_arguments(flags)
>> is not really much more complex IMHO, and not a huge reinvention.
>>
>> Also, the custom target is hidden inside tcg/tests/meson.build and not
>> exposed to arch files. Even if we had multiple projects, I would stick
>> to not exposing test() and executable() in arch files.
> 
> Fair enough.
> 
>> I would expect this file to disappear completely, and to rely on make
>> check-tcg-arch-* targets at top level instead. Would that work for you?
> 
> Yeah, you're right that at this point TCG tests are the last
> stragglers in that file. That tilts the balance for me, it does make
> sense to do this with custom_target() until Meson grows support for
> something like multi-machine projects. Just please add an alias_target
> 'build-tcg-tests-...' for compatibility with tests/Makefile.include.
>

Sure, that's a good idea.
I was wondering as well if we should build those tests by default (as
part of 'all' target). We should do this only if cross compiler is not
using any container, to avoid triggering a confusing container build.
Any opinion?

> Paolo
> 


Re: [PATCH 00/27] tests/tcg: run tests with meson
Posted by Paolo Bonzini 1 month, 2 weeks ago
On 6/11/26 21:23, Pierrick Bouvier wrote:
> Sure, that's a good idea.
> I was wondering as well if we should build those tests by default (as
> part of 'all' target). We should do this only if cross compiler is not
> using any container, to avoid triggering a confusing container build.
> Any opinion?

Definitely not if using docker/podman... but if not go for it - nobody 
will notice, they are really small.

Paolo
Re: [PATCH 00/27] tests/tcg: run tests with meson
Posted by Pierrick Bouvier 1 month, 2 weeks ago
For reference:

On 6/9/2026 2:47 PM, Pierrick Bouvier wrote:
> It implements all requirements listed on original thread [1], except cross
> container support, which can be easily added on top once we agree on the base.
> [1] https://lore.kernel.org/qemu-devel/87wlwfsay4.fsf@draig.linaro.org/
> 

>>   - support building tests with containers

to be implemented in future version, but nothing blocking.

>>   - handle all existing tests
>>     - per-arch *-user and *-softmmu
>>       - including post test validation checks (conditional-diff-out,
validate-memory-counts.py, etc...)

Done by adding the 'wrapper' concept.

>>       - per-target overrides (some targets are broken for some tests)

Each target includes what it wants, so it's free to skip/customize any test.

>>       - custom QEMU_OPTS for some tests

Done by adding 'qemu_args'.

>>       - including sub-arch tests (e.g. x86_64 includes i386, mips64el
includes mips64 etc...)

Each target includes what it wants, including sub-arch if needed.

>>     - multiarch tests for all *-user targets
>>     - multiarch tests for all *-softmmu targets with boot.S
>>     - gdbstub tests

Done by adding 'gdb_test'.

>>       - don't forget gdb feature probing for arch and arch features
(e.g. GDB_HAS_SME_TILES)

Done by comparing gdb version as needed from meson.

>>     - record/replay tests

Done by adding a record_replay wrapper.

>>     - tcg plugin tests

Done by adding 'plugin_test'.

>>       - modulate plugins over tests to avoid combinatorial explosion

Not implemented at the moment, but we can use any heuristic to limit the
PxT expansion.

>>       - filter some plugins from general testing (e.g. patch)
>>       - filter some plugins based on mode (e.g. syscall)
>>       - specific plugins with specific tests (e.g. patch, memory)

Each plugin test is explicit, so we are free to implement any policy.

>>     - support build variations

Done by adding 'cflags' and ensuring we can't create an accidental
duplication.

>>       - compiler feature probing to gate tests

Done directly in meson by testing compiler.

>>       - custom cflags for some tests

Done by adding 'cflags'.

>>       - alternate cflag builds for some tests (e.g.
sha512-[vector|sse|mvx|...])

Done by specifying a different 'cflags', and an alternate executable
name with 'exe_name'. We ensure duplication is explicit.

>>       - build scripts (e.g. test-mmx.py)

Not needed in aarch64 at the moment. For this use case, we'll generate a
header using a custom target, which will be a dependency of final test.

Regards,
Pierrick