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/[email protected]/
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