All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/37] tests/tcg: run tests with meson
@ 2026-06-26 23:38 Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 01/37] tests/tcg/multiarch/system/memory.c: remove unused variable Pierrick Bouvier
                   ` (37 more replies)
  0 siblings, 38 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

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.

It implements all requirements listed on original thread [1].

[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 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
make tcg-tests

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

v2:
--

- s/mispell/misspell
- moved comment about why we remove 'lib' prefix for plugins
- if user declare a wrong entry in a dictionary, list possible keys
- build tests by default (with 'all' target), as long as cross compiler is
  natively installed, to avoid triggering a container build.
- reword some comments based on reviewers feedback
- always declare all tests and avoid "per config" errors (no 'if' in arch files)
- move compiler feature and gdb version checks directly in tests/tcg/meson.build
- add support for cross containers
- add top target 'tcg-tests' to rebuild all tests

Pierrick Bouvier (37):
  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/tcg/meson.build: add logic to skip tests
  tests/tcg/meson.build: introduce cc_feat and cc_feat_cflags
  tests/tcg/meson.build: introduce gdb_feat and gdb_feat_version
  tests/tcg/meson.build: move gdb_arch support check
  tests/tcg/aarch64: delegate cc_feat and gdb_feat
  tests/tcg/meson.build: let test infrastructure detect compiler
  tests/docker/docker.py: return error code if probe fails
  tests/tcg/meson.build: introduce cc_dockerfile
  tests/tcg/aarch64: add container support
  tests/tcg/meson.build: add top-level 'tcg-tests' target

 tests/docker/docker.py                        |   1 +
 tests/meson.build                             |   2 +-
 tests/tcg/aarch64/meson.build                 | 193 +++++++++
 tests/tcg/aarch64/system/meson.build          | 101 +++++
 tests/tcg/meson.build                         | 402 ++++++++++++++++++
 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             |  15 +
 tests/tcg/scripts/run_with_input.sh           |  12 +
 18 files changed, 1019 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.47.3



^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 01/37] tests/tcg/multiarch/system/memory.c: remove unused variable
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 02/37] tests/tcg/multiarch/plugin/check-plugin-output.sh: take test output as input Pierrick Bouvier
                   ` (36 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss,
	Philippe Mathieu-Daudé

Caught this since by compiling this file with -Wall, -Werror.

../tests/tcg/aarch64/system/../../multiarch/system/memory.c: In function ‘init_test_data_s8’:
../tests/tcg/aarch64/system/../../multiarch/system/memory.c:97:18: error: unused variable ‘bottom’ [-Werror=unused-variable]
   97 |     uint8_t top, bottom, *ptr = &test_data[0];
      |                  ^~~~~~
../tests/tcg/aarch64/system/../../multiarch/system/memory.c:97:13: error: unused variable ‘top’ [-Werror=unused-variable]
   97 |     uint8_t top, bottom, *ptr = &test_data[0];
      |             ^~~
../tests/tcg/aarch64/system/../../multiarch/system/memory.c: In function ‘read_test_data_s8’:
../tests/tcg/aarch64/system/../../multiarch/system/memory.c:384:14: error: unused variable ‘ok’ [-Werror=unused-variable]
  384 |         bool ok;
      |

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/multiarch/system/memory.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/tcg/multiarch/system/memory.c b/tests/tcg/multiarch/system/memory.c
index 7508f6b916d..adc7ac60c1f 100644
--- a/tests/tcg/multiarch/system/memory.c
+++ b/tests/tcg/multiarch/system/memory.c
@@ -94,7 +94,7 @@ static inline uint8_t get_byte(int index, bool neg)
 
 static void init_test_data_s8(bool neg_first)
 {
-    uint8_t top, bottom, *ptr = &test_data[0];
+    uint8_t *ptr = &test_data[0];
     int i;
 
     ml_printf("Filling test area with s8 pairs (%s):",
@@ -381,7 +381,6 @@ static bool read_test_data_s8(int offset, bool neg_first)
 
     for (i = 0; i < max; i++) {
         int16_t first, second;
-        bool ok;
         first = *ptr++;
         second = *ptr++;
 
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 02/37] tests/tcg/multiarch/plugin/check-plugin-output.sh: take test output as input
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 01/37] tests/tcg/multiarch/system/memory.c: remove unused variable Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 03/37] tests/tcg/multiarch/plugin: rename check-plugin-output to regex-compare Pierrick Bouvier
                   ` (35 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

Instead of executing test, just read it's output from a file. This
allows to standardize how to call check plugins scripts.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/multiarch/Makefile.target           |  3 +--
 .../multiarch/plugin/check-plugin-output.sh   | 22 ++++++-------------
 2 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target
index 508149d57bd..f46983cc76e 100644
--- a/tests/tcg/multiarch/Makefile.target
+++ b/tests/tcg/multiarch/Makefile.target
@@ -211,8 +211,7 @@ run-plugin-test-plugin-mem-access-with-libmem.so: \
 	PLUGIN_ARGS=$(COMMA)print-accesses=true
 run-plugin-test-plugin-mem-access-with-libmem.so: \
 	CHECK_PLUGIN_OUTPUT_COMMAND= \
-	$(SRC_PATH)/tests/tcg/multiarch/plugin/check-plugin-output.sh \
-	$(QEMU) $<
+	$(SRC_PATH)/tests/tcg/multiarch/plugin/check-plugin-output.sh $@.out
 run-plugin-test-plugin-syscall-filter-with-libsyscall.so:
 run-plugin-test-plugin-set-pc-with-libsetpc.so:
 
diff --git a/tests/tcg/multiarch/plugin/check-plugin-output.sh b/tests/tcg/multiarch/plugin/check-plugin-output.sh
index 80607f04b5d..338c9ced23e 100755
--- a/tests/tcg/multiarch/plugin/check-plugin-output.sh
+++ b/tests/tcg/multiarch/plugin/check-plugin-output.sh
@@ -1,8 +1,7 @@
 #!/usr/bin/env bash
 
-# This script runs a given executable using qemu, and compare its standard
-# output with an expected plugin output.
-# Each line of output is searched (as a regexp) in the expected plugin output.
+# This script checks that plugin_output contains line from test_output.
+# Each line of output is searched (as a regexp) in plugin_output.
 
 set -euo pipefail
 
@@ -19,18 +18,11 @@ check()
     grep "$pattern" "$file" > /dev/null || die "\"$pattern\" not found in $file"
 }
 
-[ $# -eq 3 ] || die "usage: qemu_bin exe plugin_out_file"
+[ $# -eq 2 ] || die "usage: test_output plugin_out"
 
-qemu_bin=$1; shift
-exe=$1;shift
-plugin_out=$1; shift
+test_output=$1;shift
+plugin_output=$1;shift
 
-expected()
-{
-    $qemu_bin $exe ||
-        die "running $exe failed"
-}
-
-expected | while read line; do
-    check "$plugin_out" "$line"
+cat $test_output | while read line; do
+    check "$plugin_output" "$line"
 done
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 03/37] tests/tcg/multiarch/plugin: rename check-plugin-output to regex-compare
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 01/37] tests/tcg/multiarch/system/memory.c: remove unused variable Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 02/37] tests/tcg/multiarch/plugin/check-plugin-output.sh: take test output as input Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 04/37] tests/tcg: introduce meson.build Pierrick Bouvier
                   ` (34 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

We'll reuse this name later in the series, so change existing script.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/multiarch/Makefile.target                             | 2 +-
 .../plugin/{check-plugin-output.sh => regex-compare.sh}         | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename tests/tcg/multiarch/plugin/{check-plugin-output.sh => regex-compare.sh} (100%)

diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target
index f46983cc76e..6907c2830aa 100644
--- a/tests/tcg/multiarch/Makefile.target
+++ b/tests/tcg/multiarch/Makefile.target
@@ -211,7 +211,7 @@ run-plugin-test-plugin-mem-access-with-libmem.so: \
 	PLUGIN_ARGS=$(COMMA)print-accesses=true
 run-plugin-test-plugin-mem-access-with-libmem.so: \
 	CHECK_PLUGIN_OUTPUT_COMMAND= \
-	$(SRC_PATH)/tests/tcg/multiarch/plugin/check-plugin-output.sh $@.out
+	$(SRC_PATH)/tests/tcg/multiarch/plugin/regex-compare.sh $@.out
 run-plugin-test-plugin-syscall-filter-with-libsyscall.so:
 run-plugin-test-plugin-set-pc-with-libsetpc.so:
 
diff --git a/tests/tcg/multiarch/plugin/check-plugin-output.sh b/tests/tcg/multiarch/plugin/regex-compare.sh
similarity index 100%
rename from tests/tcg/multiarch/plugin/check-plugin-output.sh
rename to tests/tcg/multiarch/plugin/regex-compare.sh
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 04/37] tests/tcg: introduce meson.build
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (2 preceding siblings ...)
  2026-06-26 23:38 ` [PATCH v2 03/37] tests/tcg/multiarch/plugin: rename check-plugin-output to regex-compare Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 05/37] tests/tcg/meson.build: introduce exe_name Pierrick Bouvier
                   ` (33 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

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 <pierrick.bouvier@oss.qualcomm.com>
---
 tests/meson.build     |  2 +-
 tests/tcg/meson.build | 95 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/meson.build

diff --git a/tests/meson.build b/tests/meson.build
index 9ba04bbedd3..5877d2f60b1 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -74,7 +74,7 @@ subdir('decode')
 
 if 'CONFIG_TCG' in config_all_accel
   subdir('fp')
-  subdir('tcg/plugins')
+  subdir('tcg')
 endif
 
 subdir('audio')
diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
new file mode 100644
index 00000000000..c54c503eb17
--- /dev/null
+++ b/tests/tcg/meson.build
@@ -0,0 +1,95 @@
+env = find_program('env')
+
+tcg_tests = {}
+# tcg_tests is a dictionary with following structure:
+#
+# {
+#   'name_of_target': {
+#     'cc': cross_compiler,
+#     'folder': 'folder_for_test_src_files',
+#     'qemu': emulators['qemu-...'],
+#     'tests': [
+#       {
+#         'src_file': {
+#         }
+#       },
+#       ...
+#     ]
+#   }
+# }
+#
+# Every test executable, 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.
+
+# plugins come first, as we need to build the list
+subdir('plugins')
+
+# Finally, we can create all test executables and test targets
+foreach target, plan: tcg_tests
+  # Detect duplicated executables/tests, and report an error to force user to
+  # choose how to deal with it.
+  built_tests = {}
+  added_tests = {}
+
+  # return a clear error if user misspell a target entry
+  foreach key, _ : plan
+    allowed = ['cc', 'folder', 'qemu', 'tests']
+    if key not in allowed
+      error('unknown tcg test plan entry \'' + key + '\' for target ' + target +
+            ' (possible: [' + ', '.join(allowed) + '])')
+    endif
+  endforeach
+
+  cc = plan['cc']
+  folder = plan['folder']
+  qemu = plan['qemu']
+  tests = plan['tests']
+
+  foreach t : tests
+    foreach src, setup: t
+      # meson '/' operator drops left operand if right is an absolute path
+      src = folder / src
+      file = files(src)
+      exe_name = fs.stem(src)
+
+      exe_name = target + '-' + exe_name
+      test_name = exe_name
+
+      if test_name in added_tests
+        error('test ' + test_name + ' was already added: ' +
+              'specify a different \'test_name\'')
+      endif
+
+      # 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: true)
+        built_tests += {exe_name: exe}
+      endif
+
+      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
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 05/37] tests/tcg/meson.build: introduce exe_name
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (3 preceding siblings ...)
  2026-06-26 23:38 ` [PATCH v2 04/37] tests/tcg: introduce meson.build Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 06/37] tests/tcg/meson.build: introduce test_name Pierrick Bouvier
                   ` (32 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

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 <pierrick.bouvier@oss.qualcomm.com>
---
 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 c54c503eb17..d2b11bd6593 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')
@@ -49,10 +50,22 @@ foreach target, plan: tcg_tests
 
   foreach t : tests
     foreach src, setup: t
+      # return a clear error if user misspell a setup entry
+      foreach key, _ : setup
+        allowed = ['exe_name']
+        if key not in allowed
+          error('unknown tcg setup entry \'' + key + '\' for test ' + src +
+                ' (possible: [' + ', '.join(allowed) + '])')
+        endif
+      endforeach
+
       # meson '/' operator drops left operand if right is an absolute path
       src = folder / src
       file = files(src)
       exe_name = fs.stem(src)
+      if 'exe_name' in setup
+        exe_name = setup['exe_name']
+      endif
 
       exe_name = target + '-' + exe_name
       test_name = exe_name
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 06/37] tests/tcg/meson.build: introduce test_name
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (4 preceding siblings ...)
  2026-06-26 23:38 ` [PATCH v2 05/37] tests/tcg/meson.build: introduce exe_name Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 07/37] tests/tcg/meson.build: introduce cflags Pierrick Bouvier
                   ` (31 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

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.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index d2b11bd6593..49c8681e53e 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,9 @@ 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. Several tests for the same executable can
+# declared using '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')
@@ -52,7 +54,7 @@ foreach target, plan: tcg_tests
     foreach src, setup: t
       # return a clear error if user misspell a setup entry
       foreach key, _ : setup
-        allowed = ['exe_name']
+        allowed = ['exe_name', 'test_name']
         if key not in allowed
           error('unknown tcg setup entry \'' + key + '\' for test ' + src +
                 ' (possible: [' + ', '.join(allowed) + '])')
@@ -67,8 +69,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.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 07/37] tests/tcg/meson.build: introduce cflags
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (5 preceding siblings ...)
  2026-06-26 23:38 ` [PATCH v2 06/37] tests/tcg/meson.build: introduce test_name Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 08/37] tests/tcg/meson.build: introduce qemu_args Pierrick Bouvier
                   ` (30 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

We add possibility to declare cflags for a given test. Since we want to
preserve the uniqueness of test binaries, we prevent repeating those
cflags later, for an existing binary.

This ensures one executable == one set of cflags, and if dev needs
duplication, they can use a custom 'exe_name' to override this.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index 49c8681e53e..47a600e4bd6 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -13,6 +13,7 @@ tcg_tests = {}
 #         'src_file': {
 #           'exe_name': ['provide an alternative binary name'],
 #           'test_name': ['provide an alternative test name'],
+#           'cflags': ['additional cflags to compile test', ...],
 #         }
 #       },
 #       ...
@@ -20,7 +21,8 @@ tcg_tests = {}
 #   }
 # }
 #
-# Every test executable, identified by 'exe_name' is built only once.
+# Every test executable, identified by 'exe_name' is built only once, and we
+# ensure cflags are specified only once, on first declaration.
 # Tests for a given src use the same executable by default, and their definition
 # is guaranteed to be unique also. Several tests for the same executable can
 # declared using 'test_name'.
@@ -54,7 +56,7 @@ foreach target, plan: tcg_tests
     foreach src, setup: t
       # return a clear error if user misspell a setup entry
       foreach key, _ : setup
-        allowed = ['exe_name', 'test_name']
+        allowed = ['exe_name', 'cflags', 'test_name']
         if key not in allowed
           error('unknown tcg setup entry \'' + key + '\' for test ' + src +
                 ' (possible: [' + ', '.join(allowed) + '])')
@@ -82,6 +84,15 @@ foreach target, plan: tcg_tests
               'specify a different \'test_name\'')
       endif
 
+      cflags = []
+      if 'cflags' in setup
+        if exe_name in built_tests
+          error('test ' + exe_name + ' was already built with cflags: ' +
+                'remove cflags or set \'exe_name\' (if cflags are different)')
+        endif
+        cflags = setup['cflags']
+      endif
+
       # build executable if needed
       if exe_name not in built_tests
         exe = custom_target(exe_name,
@@ -91,7 +102,7 @@ foreach target, plan: tcg_tests
                                       '-MMD', '-MF', '@DEPFILE@',
                                       '-Wall', '-Werror',
                                       '-O0', '-g', '-fno-strict-aliasing',
-                                      ],
+                                      cflags],
                             depfile: exe_name + '.d',
                             output: exe_name + '.test',
                             build_by_default: true)
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 08/37] tests/tcg/meson.build: introduce qemu_args
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (6 preceding siblings ...)
  2026-06-26 23:38 ` [PATCH v2 07/37] tests/tcg/meson.build: introduce cflags Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 09/37] tests/tcg/meson.build: introduce env_var Pierrick Bouvier
                   ` (29 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss,
	Philippe Mathieu-Daudé

We add possibility to use custom arguments when calling qemu for a test.

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index 47a600e4bd6..d1a5bf3deab 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -14,6 +14,7 @@ tcg_tests = {}
 #           'exe_name': ['provide an alternative binary name'],
 #           'test_name': ['provide an alternative test name'],
 #           'cflags': ['additional cflags to compile test', ...],
+#           'qemu_args': ['qemu command line flags', ...],
 #         }
 #       },
 #       ...
@@ -56,7 +57,7 @@ foreach target, plan: tcg_tests
     foreach src, setup: t
       # return a clear error if user misspell a setup entry
       foreach key, _ : setup
-        allowed = ['exe_name', 'cflags', 'test_name']
+        allowed = ['exe_name', 'cflags', 'qemu_args', 'test_name']
         if key not in allowed
           error('unknown tcg setup entry \'' + key + '\' for test ' + src +
                 ' (possible: [' + ', '.join(allowed) + '])')
@@ -110,9 +111,13 @@ foreach target, plan: tcg_tests
       endif
 
       depends = []
+      qemu_args = []
+      if 'qemu_args' in setup
+        qemu_args = setup['qemu_args']
+      endif
 
       exe = built_tests[exe_name]
-      cmd = [qemu, exe]
+      cmd = [qemu, qemu_args, exe]
 
       # some tests expect QEMU env var to be set
       cmd = ['QEMU=' + qemu.full_path(), cmd]
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 09/37] tests/tcg/meson.build: introduce env_var
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (7 preceding siblings ...)
  2026-06-26 23:38 ` [PATCH v2 08/37] tests/tcg/meson.build: introduce qemu_args Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 10/37] tests/tcg/plugins: build list of test_plugins Pierrick Bouvier
                   ` (28 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

We add possibility to set an environment variable when running a test.
An example of a test requiring this is
tests/tcg/multiarch/linux/linux-sigrtminmax.c.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index d1a5bf3deab..c7830d2c17b 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -15,6 +15,7 @@ tcg_tests = {}
 #           'test_name': ['provide an alternative test name'],
 #           'cflags': ['additional cflags to compile test', ...],
 #           'qemu_args': ['qemu command line flags', ...],
+#           'env_var': ['VAR=value', ...],
 #         }
 #       },
 #       ...
@@ -57,7 +58,7 @@ foreach target, plan: tcg_tests
     foreach src, setup: t
       # return a clear error if user misspell a setup entry
       foreach key, _ : setup
-        allowed = ['exe_name', 'cflags', 'qemu_args', 'test_name']
+        allowed = ['exe_name', 'env_var', 'cflags', 'qemu_args', 'test_name']
         if key not in allowed
           error('unknown tcg setup entry \'' + key + '\' for test ' + src +
                 ' (possible: [' + ', '.join(allowed) + '])')
@@ -122,6 +123,10 @@ foreach target, plan: tcg_tests
       # some tests expect QEMU env var to be set
       cmd = ['QEMU=' + qemu.full_path(), cmd]
 
+      if 'env_var' in setup
+        cmd = [setup['env_var'], cmd]
+      endif
+
       test(test_name, env, args: cmd,
            depends: depends,
            suite: ['tcg', 'tcg-' + target])
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 10/37] tests/tcg/plugins: build list of test_plugins
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (8 preceding siblings ...)
  2026-06-26 23:38 ` [PATCH v2 09/37] tests/tcg/meson.build: introduce env_var Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 11/37] tests/tcg/meson.build: introduce plugin_test Pierrick Bouvier
                   ` (27 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

We previously had list of test_plugins sources, but not the target
themselves. Create this list, so tests can then reference a plugin by
its name from there.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build         |  1 +
 tests/tcg/plugins/meson.build | 11 +++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index c7830d2c17b..f5f518fca1b 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -31,6 +31,7 @@ tcg_tests = {}
 # Default name is derived from src if 'exe_name' and 'test_name' are omitted.
 
 # plugins come first, as we need to build the list
+test_plugins = {}
 subdir('plugins')
 
 # Finally, we can create all test executables and test targets
diff --git a/tests/tcg/plugins/meson.build b/tests/tcg/plugins/meson.build
index d7f8f0ae0ad..2abc317d1e7 100644
--- a/tests/tcg/plugins/meson.build
+++ b/tests/tcg/plugins/meson.build
@@ -1,4 +1,4 @@
-test_plugins = [
+test_plugins_src = [
 'bb.c',
 'discons.c',
 'empty.c',
@@ -14,9 +14,12 @@ test_plugins = [
 
 t = []
 if get_option('plugins')
-  foreach i : test_plugins
-    t += shared_module(fs.stem(i), files(i),
-                       dependencies: plugins_deps)
+  foreach i : test_plugins_src
+    name = fs.stem(i)
+    plugin = shared_module(name, files(i),
+                           dependencies: plugins_deps)
+    t += plugin
+    test_plugins += {name: plugin}
   endforeach
 endif
 if t.length() > 0
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 11/37] tests/tcg/meson.build: introduce plugin_test
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (9 preceding siblings ...)
  2026-06-26 23:38 ` [PATCH v2 10/37] tests/tcg/plugins: build list of test_plugins Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 12/37] tests/tcg/meson.build: test gdb support and introduce gdb_arch Pierrick Bouvier
                   ` (26 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

We add possibility to declare a test that is based on a plugin.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build | 43 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index f5f518fca1b..8419520d9ff 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -16,6 +16,10 @@ tcg_tests = {}
 #           'cflags': ['additional cflags to compile test', ...],
 #           'qemu_args': ['qemu command line flags', ...],
 #           'env_var': ['VAR=value', ...],
+#           'plugin_test': {
+#             'plugin': 'plugin_name',
+#             'args': ['plugin_args', ...],
+#           },
 #         }
 #       },
 #       ...
@@ -59,13 +63,29 @@ foreach target, plan: tcg_tests
     foreach src, setup: t
       # return a clear error if user misspell a setup entry
       foreach key, _ : setup
-        allowed = ['exe_name', 'env_var', 'cflags', 'qemu_args', 'test_name']
+        allowed = ['exe_name', 'env_var', 'cflags', 'plugin_test',
+                   'qemu_args', 'test_name']
         if key not in allowed
           error('unknown tcg setup entry \'' + key + '\' for test ' + src +
                 ' (possible: [' + ', '.join(allowed) + '])')
         endif
       endforeach
 
+      # return a clear error if user misspell a plugin entry
+      if 'plugin_test' in setup
+        foreach key, _ : setup['plugin_test']
+          allowed = ['args', 'plugin']
+          if key not in allowed
+            error('unknown tcg plugin entry \'' + key + '\' for test ' + src +
+                  ' (possible: [' + ', '.join(allowed) + '])')
+          endif
+        endforeach
+      endif
+
+      if 'plugin_test' in setup and not get_option('plugins')
+        continue
+      endif
+
       # meson '/' operator drops left operand if right is an absolute path
       src = folder / src
       file = files(src)
@@ -78,6 +98,12 @@ foreach target, plan: tcg_tests
       if 'test_name' in setup
         test_name = setup['test_name']
       endif
+      if 'plugin_test' in setup
+        plugin = test_plugins[setup['plugin_test']['plugin']]
+        # remove 'lib' prefix
+        plugin_name = fs.stem(plugin).substring(3)
+        test_name = 'plugin-' + plugin_name + '-with-' + test_name
+      endif
 
       exe_name = target + '-' + exe_name
       test_name = target + '-' + test_name
@@ -118,6 +144,21 @@ foreach target, plan: tcg_tests
         qemu_args = setup['qemu_args']
       endif
 
+      if 'plugin_test' in setup
+        plugin_setup = setup['plugin_test']
+        plugin = test_plugins[plugin_setup['plugin']]
+        plugin_args = []
+        if 'args' in plugin_setup
+          # add empty arg to generate an additional comma
+          plugin_args = ['', plugin_setup['args']]
+        endif
+        plugin_args = ','.join(plugin_args)
+
+        # since we turn plugin into a string, add dependency explicitly
+        depends += plugin
+        qemu_args = ['-plugin', plugin.full_path() + plugin_args, qemu_args]
+      endif
+
       exe = built_tests[exe_name]
       cmd = [qemu, qemu_args, exe]
 
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 12/37] tests/tcg/meson.build: test gdb support and introduce gdb_arch
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (10 preceding siblings ...)
  2026-06-26 23:38 ` [PATCH v2 11/37] tests/tcg/meson.build: introduce plugin_test Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 13/37] tests/tcg/meson.build: introduce gdb_test Pierrick Bouvier
                   ` (25 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

A given target can now declare which gdb architecture it requires.
Also, we add the code to check gdb capabilities, and version.
Tests can use gdb_version.version_compare('>=X.Y') to test this.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index 8419520d9ff..2a2e619e363 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -1,5 +1,11 @@
 env = find_program('env')
 
+gdb_progs = ['gdb-multiarch', 'gdb']
+if config_host.has_key('GDB')
+  gdb_progs = [config_host['GDB'], gdb_progs]
+endif
+gdb = find_program(gdb_progs, required: false)
+
 tcg_tests = {}
 # tcg_tests is a dictionary with following structure:
 #
@@ -7,6 +13,7 @@ tcg_tests = {}
 #   'name_of_target': {
 #     'cc': cross_compiler,
 #     'folder': 'folder_for_test_src_files',
+#     'gdb_arch': 'gdb architecture requirement',
 #     'qemu': emulators['qemu-...'],
 #     'tests': [
 #       {
@@ -34,6 +41,18 @@ tcg_tests = {}
 # declared using 'test_name'.
 # Default name is derived from src if 'exe_name' and 'test_name' are omitted.
 
+gdb_arch_supported = {}
+gdb_version = '0'
+if gdb.found()
+  gdb_version = gdb.version()
+  gdb_arch = run_command(python, files('../../scripts/probe-gdb-support.py'),
+                           gdb,
+                           check: true)
+  foreach arch: gdb_arch.stdout().split()
+    gdb_arch_supported += {arch: true}
+  endforeach
+endif
+
 # plugins come first, as we need to build the list
 test_plugins = {}
 subdir('plugins')
@@ -47,7 +66,7 @@ foreach target, plan: tcg_tests
 
   # return a clear error if user misspell a target entry
   foreach key, _ : plan
-    allowed = ['cc', 'folder', 'qemu', 'tests']
+    allowed = ['cc', 'folder', 'gdb_arch', 'qemu', 'tests']
     if key not in allowed
       error('unknown tcg test plan entry \'' + key + '\' for target ' + target +
             ' (possible: [' + ', '.join(allowed) + '])')
@@ -56,6 +75,7 @@ foreach target, plan: tcg_tests
 
   cc = plan['cc']
   folder = plan['folder']
+  gdb_arch = plan['gdb_arch']
   qemu = plan['qemu']
   tests = plan['tests']
 
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 13/37] tests/tcg/meson.build: introduce gdb_test
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (11 preceding siblings ...)
  2026-06-26 23:38 ` [PATCH v2 12/37] tests/tcg/meson.build: test gdb support and introduce gdb_arch Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 14/37] tests/tcg/meson.build: add default flag for testing compiler support Pierrick Bouvier
                   ` (24 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

We can now declare a test requiring gdb interaction, based on
tests/guest-debug/run-test.py.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index 2a2e619e363..35af4c609dd 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -5,6 +5,7 @@ if config_host.has_key('GDB')
   gdb_progs = [config_host['GDB'], gdb_progs]
 endif
 gdb = find_program(gdb_progs, required: false)
+prog_gdb_test = find_program('../guest-debug/run-test.py')
 
 tcg_tests = {}
 # tcg_tests is a dictionary with following structure:
@@ -22,6 +23,7 @@ tcg_tests = {}
 #           'test_name': ['provide an alternative test name'],
 #           'cflags': ['additional cflags to compile test', ...],
 #           'qemu_args': ['qemu command line flags', ...],
+#           'gdb_test': ['gdb test args'],
 #           'env_var': ['VAR=value', ...],
 #           'plugin_test': {
 #             'plugin': 'plugin_name',
@@ -83,7 +85,7 @@ foreach target, plan: tcg_tests
     foreach src, setup: t
       # return a clear error if user misspell a setup entry
       foreach key, _ : setup
-        allowed = ['exe_name', 'env_var', 'cflags', 'plugin_test',
+        allowed = ['exe_name', 'env_var', 'cflags', 'gdb_test', 'plugin_test',
                    'qemu_args', 'test_name']
         if key not in allowed
           error('unknown tcg setup entry \'' + key + '\' for test ' + src +
@@ -102,6 +104,10 @@ foreach target, plan: tcg_tests
         endforeach
       endif
 
+      if 'gdb_test' in setup and gdb_arch not in gdb_arch_supported
+        continue
+      endif
+
       if 'plugin_test' in setup and not get_option('plugins')
         continue
       endif
@@ -118,7 +124,9 @@ foreach target, plan: tcg_tests
       if 'test_name' in setup
         test_name = setup['test_name']
       endif
-      if 'plugin_test' in setup
+      if 'gdb_test' in setup
+        test_name = 'gdb-' + test_name
+      elif 'plugin_test' in setup
         plugin = test_plugins[setup['plugin_test']['plugin']]
         # remove 'lib' prefix
         plugin_name = fs.stem(plugin).substring(3)
@@ -182,6 +190,16 @@ foreach target, plan: tcg_tests
       exe = built_tests[exe_name]
       cmd = [qemu, qemu_args, exe]
 
+      if 'gdb_test' in setup
+        cmd = [prog_gdb_test,
+               '--gdb', gdb,
+               '--qemu', qemu,
+               '--qargs', ' '.join(qemu_args),
+               '--bin', exe,
+               setup['gdb_test'],
+              ]
+      endif
+
       # some tests expect QEMU env var to be set
       cmd = ['QEMU=' + qemu.full_path(), cmd]
 
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 14/37] tests/tcg/meson.build: add default flag for testing compiler support
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (12 preceding siblings ...)
  2026-06-26 23:38 ` [PATCH v2 13/37] tests/tcg/meson.build: introduce gdb_test Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 15/37] tests/tcg/meson.build: introduce wrapper Pierrick Bouvier
                   ` (23 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss,
	Philippe Mathieu-Daudé

This global variable can be used as cflags when checking if a compiler
supports specific flags.

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index 35af4c609dd..fa9c0d15342 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -1,3 +1,4 @@
+cc_check_args = ['-xc', '/dev/null', '-o', '/dev/null', '-c']
 env = find_program('env')
 
 gdb_progs = ['gdb-multiarch', 'gdb']
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 15/37] tests/tcg/meson.build: introduce wrapper
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (13 preceding siblings ...)
  2026-06-26 23:38 ` [PATCH v2 14/37] tests/tcg/meson.build: add default flag for testing compiler support Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 16/37] tests/tcg/meson.build: introduce expected_output Pierrick Bouvier
                   ` (22 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss,
	Philippe Mathieu-Daudé

We add possibility to wrap a test command through a given script. This
can be used to provide any kind of ad-hoc check for specific tests.

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index fa9c0d15342..ad4024f793b 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -26,6 +26,7 @@ tcg_tests = {}
 #           'qemu_args': ['qemu command line flags', ...],
 #           'gdb_test': ['gdb test args'],
 #           'env_var': ['VAR=value', ...],
+#           'wrapper': [program_to_launch_test, 'args'...],
 #           'plugin_test': {
 #             'plugin': 'plugin_name',
 #             'args': ['plugin_args', ...],
@@ -87,7 +88,7 @@ foreach target, plan: tcg_tests
       # return a clear error if user misspell a setup entry
       foreach key, _ : setup
         allowed = ['exe_name', 'env_var', 'cflags', 'gdb_test', 'plugin_test',
-                   'qemu_args', 'test_name']
+                   'qemu_args', 'test_name', 'wrapper']
         if key not in allowed
           error('unknown tcg setup entry \'' + key + '\' for test ' + src +
                 ' (possible: [' + ', '.join(allowed) + '])')
@@ -201,6 +202,10 @@ foreach target, plan: tcg_tests
               ]
       endif
 
+      if 'wrapper' in setup
+        cmd = [setup['wrapper'], cmd]
+      endif
+
       # some tests expect QEMU env var to be set
       cmd = ['QEMU=' + qemu.full_path(), cmd]
 
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 16/37] tests/tcg/meson.build: introduce expected_output
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (14 preceding siblings ...)
  2026-06-26 23:38 ` [PATCH v2 15/37] tests/tcg/meson.build: introduce wrapper Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 17/37] tests/tcg/meson.build: add wrapper run_and_check_forbidden_output Pierrick Bouvier
                   ` (21 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

A test can declare it expects a specific output on stdout. In this case,
we compare it to a reference file. We implement this instead of relying
on a wrapper because we need the flexibility to resolve name of
reference file per target.

For instance, multiarch float tests expect different ref files for each
target, which is something we can't express with a test wrapper.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build             | 12 ++++++++++--
 tests/tcg/scripts/run_and_diff.sh | 15 +++++++++++++++
 2 files changed, 25 insertions(+), 2 deletions(-)
 create mode 100755 tests/tcg/scripts/run_and_diff.sh

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index ad4024f793b..f052e731de6 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -7,6 +7,7 @@ if config_host.has_key('GDB')
 endif
 gdb = find_program(gdb_progs, required: false)
 prog_gdb_test = find_program('../guest-debug/run-test.py')
+prog_run_and_diff = find_program('./scripts/run_and_diff.sh')
 
 tcg_tests = {}
 # tcg_tests is a dictionary with following structure:
@@ -24,6 +25,7 @@ tcg_tests = {}
 #           'test_name': ['provide an alternative test name'],
 #           'cflags': ['additional cflags to compile test', ...],
 #           'qemu_args': ['qemu command line flags', ...],
+#           'expected_output': 'file_to_compare_output',
 #           'gdb_test': ['gdb test args'],
 #           'env_var': ['VAR=value', ...],
 #           'wrapper': [program_to_launch_test, 'args'...],
@@ -87,8 +89,9 @@ foreach target, plan: tcg_tests
     foreach src, setup: t
       # return a clear error if user misspell a setup entry
       foreach key, _ : setup
-        allowed = ['exe_name', 'env_var', 'cflags', 'gdb_test', 'plugin_test',
-                   'qemu_args', 'test_name', 'wrapper']
+        allowed = ['exe_name', 'env_var', 'expected_output', 'cflags',
+                   'gdb_test', 'plugin_test', 'qemu_args', 'test_name',
+                   'wrapper']
         if key not in allowed
           error('unknown tcg setup entry \'' + key + '\' for test ' + src +
                 ' (possible: [' + ', '.join(allowed) + '])')
@@ -202,6 +205,11 @@ foreach target, plan: tcg_tests
               ]
       endif
 
+      if 'expected_output' in setup
+        expected = files(folder / setup['expected_output'])
+        cmd = [prog_run_and_diff, expected, cmd]
+      endif
+
       if 'wrapper' in setup
         cmd = [setup['wrapper'], cmd]
       endif
diff --git a/tests/tcg/scripts/run_and_diff.sh b/tests/tcg/scripts/run_and_diff.sh
new file mode 100755
index 00000000000..3e51cdc9663
--- /dev/null
+++ b/tests/tcg/scripts/run_and_diff.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+set -euo pipefail
+
+if [ $# -lt 2 ]; then
+    echo "run_and_diff: expected_output_file cmd [args]..." 1>&2
+    exit 1
+fi
+expected="$1";shift
+output=$(mktemp)
+trap "rm -rf $output" EXIT
+set -x
+"$@" |& tee $output
+diff $output $expected
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 17/37] tests/tcg/meson.build: add wrapper run_and_check_forbidden_output
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (15 preceding siblings ...)
  2026-06-26 23:38 ` [PATCH v2 16/37] tests/tcg/meson.build: introduce expected_output Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:38 ` [PATCH v2 18/37] tests/tcg/meson.build: add wrapper run_with_input Pierrick Bouvier
                   ` (20 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

One of our test requires to make sure output does not contain a specific
string. An example is system multiarch test run-gdbstub-untimely-packet.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build                         |  3 +++
 .../scripts/run_and_check_forbidden_output.sh | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+)
 create mode 100755 tests/tcg/scripts/run_and_check_forbidden_output.sh

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index f052e731de6..130f8a83c54 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -8,6 +8,9 @@ endif
 gdb = find_program(gdb_progs, required: false)
 prog_gdb_test = find_program('../guest-debug/run-test.py')
 prog_run_and_diff = find_program('./scripts/run_and_diff.sh')
+prog_run_and_check_forbidden_output = find_program(
+  './scripts/run_and_check_forbidden_output.sh'
+)
 
 tcg_tests = {}
 # tcg_tests is a dictionary with following structure:
diff --git a/tests/tcg/scripts/run_and_check_forbidden_output.sh b/tests/tcg/scripts/run_and_check_forbidden_output.sh
new file mode 100755
index 00000000000..4486ca8ef83
--- /dev/null
+++ b/tests/tcg/scripts/run_and_check_forbidden_output.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+set -euo pipefail
+
+if [ $# -lt 2 ]; then
+    echo "run_and_check_forbidden_output: 'forbidden string' cmd [args]..." 1>&2
+    exit 1
+fi
+forbidden="$1";shift
+output=$("$@" 2>&1)
+set -x
+if ! echo "$output" | grep -Fi "$forbidden"
+then
+    echo "output does not contain forbidden string: $forbidden"
+    exit 0
+fi
+echo "found forbidden string: $forbidden" 1>&2
+exit 1
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 18/37] tests/tcg/meson.build: add wrapper run_with_input
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (16 preceding siblings ...)
  2026-06-26 23:38 ` [PATCH v2 17/37] tests/tcg/meson.build: add wrapper run_and_check_forbidden_output Pierrick Bouvier
@ 2026-06-26 23:38 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 19/37] tests/tcg/meson.build: add wrapper record_replay Pierrick Bouvier
                   ` (19 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

Semihosting console tests require console interaction, and were flagged
as manual because of this. This wrapper automates interaction, by
sending a specific string on stdin.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build               |  1 +
 tests/tcg/scripts/run_with_input.sh | 12 ++++++++++++
 2 files changed, 13 insertions(+)
 create mode 100755 tests/tcg/scripts/run_with_input.sh

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index 130f8a83c54..0e6546668c9 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -8,6 +8,7 @@ endif
 gdb = find_program(gdb_progs, required: false)
 prog_gdb_test = find_program('../guest-debug/run-test.py')
 prog_run_and_diff = find_program('./scripts/run_and_diff.sh')
+prog_run_with_input = find_program('./scripts/run_with_input.sh')
 prog_run_and_check_forbidden_output = find_program(
   './scripts/run_and_check_forbidden_output.sh'
 )
diff --git a/tests/tcg/scripts/run_with_input.sh b/tests/tcg/scripts/run_with_input.sh
new file mode 100755
index 00000000000..3d280547c3a
--- /dev/null
+++ b/tests/tcg/scripts/run_with_input.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+set -euo pipefail
+
+if [ $# -lt 2 ]; then
+    echo "run_with_input: input_string cmd [args]..." 1>&2
+    exit 1
+fi
+input="$1";shift
+set -x
+echo "$input" | "$@"
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 19/37] tests/tcg/meson.build: add wrapper record_replay
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (17 preceding siblings ...)
  2026-06-26 23:38 ` [PATCH v2 18/37] tests/tcg/meson.build: add wrapper run_with_input Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 20/37] tests/tcg/meson.build: add wrapper check_plugin_output Pierrick Bouvier
                   ` (18 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

Runs a record and replay test, and make sure the output produced by
both runs is the same.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build              |  1 +
 tests/tcg/scripts/record_replay.sh | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)
 create mode 100755 tests/tcg/scripts/record_replay.sh

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index 0e6546668c9..1d08db5cd3c 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -7,6 +7,7 @@ if config_host.has_key('GDB')
 endif
 gdb = find_program(gdb_progs, required: false)
 prog_gdb_test = find_program('../guest-debug/run-test.py')
+prog_record_replay = find_program('./scripts/record_replay.sh')
 prog_run_and_diff = find_program('./scripts/run_and_diff.sh')
 prog_run_with_input = find_program('./scripts/run_with_input.sh')
 prog_run_and_check_forbidden_output = find_program(
diff --git a/tests/tcg/scripts/record_replay.sh b/tests/tcg/scripts/record_replay.sh
new file mode 100755
index 00000000000..57775a2d4c1
--- /dev/null
+++ b/tests/tcg/scripts/record_replay.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+set -euo pipefail
+
+if [ $# -lt 2 ]; then
+    echo "record_replay: qemu_bin [args]..." 1>&2
+    exit 1
+fi
+qemu="$1";shift
+tmp=$(mktemp -d)
+trap "rm -rf $tmp" EXIT
+set -x
+$qemu -icount shift=5,rr=record,rrfile=$tmp/rr.bin "$@" |& tee $tmp/record
+$qemu -icount shift=5,rr=replay,rrfile=$tmp/rr.bin "$@" |& tee $tmp/replay
+diff $tmp/record $tmp/replay
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 20/37] tests/tcg/meson.build: add wrapper check_plugin_output
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (18 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 19/37] tests/tcg/meson.build: add wrapper record_replay Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 21/37] tests/tcg/aarch64: add user tests Pierrick Bouvier
                   ` (17 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

This wrapper runs a qemu command, record command output and plugin
output, and forward both to a check script.
We use this pattern in several plugin tests (for instance, with
validate-memory-counts.py).

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build                    |  1 +
 tests/tcg/scripts/check_plugin_output.sh | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)
 create mode 100755 tests/tcg/scripts/check_plugin_output.sh

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index 1d08db5cd3c..fbccf72f686 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -6,6 +6,7 @@ if config_host.has_key('GDB')
   gdb_progs = [config_host['GDB'], gdb_progs]
 endif
 gdb = find_program(gdb_progs, required: false)
+prog_check_plugin_output = find_program('./scripts/check_plugin_output.sh')
 prog_gdb_test = find_program('../guest-debug/run-test.py')
 prog_record_replay = find_program('./scripts/record_replay.sh')
 prog_run_and_diff = find_program('./scripts/run_and_diff.sh')
diff --git a/tests/tcg/scripts/check_plugin_output.sh b/tests/tcg/scripts/check_plugin_output.sh
new file mode 100755
index 00000000000..4d12e23ad60
--- /dev/null
+++ b/tests/tcg/scripts/check_plugin_output.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+set -euo pipefail
+
+if [ $# -lt 3 ]; then
+    echo "check_plugin_output: check_cmd qemu_bin [args]..." 1>&2
+    exit 1
+fi
+check_cmd="$1"; shift
+qemu="$1"; shift
+tmp=$(mktemp -d)
+trap "rm -rf $tmp" EXIT
+
+set -x
+
+$qemu -d plugin -D $tmp/plugin "$@" |& tee $tmp/output
+cat $tmp/plugin
+$check_cmd $tmp/output $tmp/plugin
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 21/37] tests/tcg/aarch64: add user tests
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (19 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 20/37] tests/tcg/meson.build: add wrapper check_plugin_output Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 22/37] tests/tcg/aarch64: add system tests Pierrick Bouvier
                   ` (16 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

We are finally ready to add tests. Let's start with aarch64 user first.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/aarch64/meson.build | 213 ++++++++++++++++++++++++++++++++++
 tests/tcg/meson.build         |   3 +
 2 files changed, 216 insertions(+)
 create mode 100644 tests/tcg/aarch64/meson.build

diff --git a/tests/tcg/aarch64/meson.build b/tests/tcg/aarch64/meson.build
new file mode 100644
index 00000000000..9c42b129551
--- /dev/null
+++ b/tests/tcg/aarch64/meson.build
@@ -0,0 +1,213 @@
+cc = find_program('aarch64-linux-gnu-gcc', required : false)
+
+if not cc.found()
+  subdir_done()
+endif
+
+feat_cflags = {
+  'aes': '-march=armv8-a+aes',
+  'sve': '-march=armv8.1-a+sve',
+  'sve2': '-march=armv8.1-a+sve2',
+  'v8.2': '-march=armv8.2-a',
+  'v8.3': '-march=armv8.3-a',
+  'v8.5': '-march=armv8.5-a',
+  'bti':  '-mbranch-protection=standard',
+  'mte':  '-march=armv8.5-a+memtag',
+  'sme':  '-Wa,-march=armv9-a+sme',
+}
+cc_has_feat = {}
+
+foreach feat, flags : feat_cflags
+  cmd = run_command([cc, cc_check_args, flags], check: false)
+  avail = cmd.returncode() == 0
+  cc_has_feat += {feat: avail}
+  if not avail
+    warning('aarch64 tcg tests for feature \'' + feat + '\' ' +
+            'disabled: unsupported by cross-compiler')
+  endif
+endforeach
+
+gdb_feat_version = {
+  'sme-tiles': '14.1',
+  'mte': '15.1',
+  'mte-baremetal': '16.0',
+}
+gdb_has_feat = {}
+
+foreach feat, min_ver : gdb_feat_version
+  avail = gdb_version.version_compare('>=' + min_ver)
+  gdb_has_feat += {feat: avail}
+  if not avail
+    warning('aarch64 gdb tests for feature \'' + feat + '\' ' +
+            'disabled: unsupported by gdb')
+  endif
+endforeach
+
+if 'qemu-aarch64' not in emulators
+  subdir_done()
+endif
+
+tests = []
+
+# Base architecture tests
+tests += {
+  '../arm/fcvt.c': {'cflags': '-lm', 'expected_output': 'fcvt.ref'},
+  'pcalign-a64.c': {},
+  'lse2-fault.c': {},
+  'test-2248.c': {},
+  'test-2150.c': {},
+}
+
+if cc_has_feat['v8.2']
+  tests += {'dcpop.c': {'cflags': feat_cflags['v8.2']}}
+endif
+
+if cc_has_feat['v8.5']
+  tests += {'dcpodp.c': {'cflags': feat_cflags['v8.5']}}
+endif
+
+# Pauth Tests
+if cc_has_feat['v8.3']
+  f = feat_cflags['v8.3']
+  cpu_max = ['-cpu', 'max']
+  cpu_neoverse = ['-cpu', 'neoverse-v1']
+  tests += {
+    'test-2375.c': {'cflags': f},
+    'pauth-1.c': {'cflags': f, 'qemu_args': cpu_max},
+    'pauth-2.c': {'cflags': f, 'qemu_args': cpu_max},
+    # Choose a cpu with FEAT_Pauth but without FEAT_FPAC for pauth-[45].
+    'pauth-4.c': {'cflags': f, 'qemu_args': cpu_neoverse},
+    'pauth-5.c': {'cflags': f, 'qemu_args': cpu_neoverse},
+  }
+endif
+
+# BTI Tests
+# bti-1 tests the elf notes, so we require special compiler support.
+if cc_has_feat['bti']
+  f = [feat_cflags['bti'], '-fno-stack-protector', '-nostdlib']
+  tests += {
+    'bti-1.c': {'cflags': f},
+    'bti-3.c': {'cflags': f},
+  }
+endif
+# bti-2 tests PROT_BTI, so no special compiler support required.
+tests += {'bti-2.c': {}}
+
+# MTE Tests
+if cc_has_feat['mte']
+  f = feat_cflags['mte']
+  tests += {
+    'mte-1.c': {'cflags': f},
+    'mte-2.c': {'cflags': f},
+    'mte-3.c': {'cflags': f},
+    'mte-4.c': {'cflags': f},
+    'mte-5.c': {'cflags': f},
+    'mte-6.c': {'cflags': f},
+    'mte-7.c': {'cflags': f},
+    'mte-8.c': {'cflags': f},
+  }
+endif
+
+# SME Tests
+if cc_has_feat['sme']
+  f = feat_cflags['sme']
+  tests += {
+    'sme-outprod1.c': {'cflags': f},
+    'sme-smopa-1.c': {'cflags': f},
+    'sme-smopa-2.c': {'cflags': f},
+    'sme-fmopa-1.c': {'cflags': f},
+    'sme-fmopa-2.c': {'cflags': f},
+    'sme-fmopa-3.c': {'cflags': f},
+  }
+endif
+
+# GCS Tests
+tests += {
+  'gcsstr.c': {},
+  'gcspushm.c': {},
+  'gcsss.c': {},
+}
+
+# System Registers Tests
+tests += {'sysregs.c': {}}
+
+# Crypto Tests
+tests += {'test-aes.c': {'cflags': feat_cflags['aes']}}
+
+# SVE Tests
+if cc_has_feat['sve']
+  f = feat_cflags['sve']
+  tests += {
+    'sve-ioctls.c': {'cflags': f},
+    'sve-str.c': {'cflags': [f, '-O1']},
+  }
+endif
+
+# SVE2 Tests
+if cc_has_feat['sve2']
+  tests += {'test-826.c': {'cflags': feat_cflags['sve2']}}
+endif
+
+# GDB Tests
+if cc_has_feat['sve']
+  f = feat_cflags['sve']
+  tests += {
+    'sysregs.c': {
+      'exe_name': 'sysregs-sve',
+      'cflags': f,
+      'gdb_test': ['--test', files('gdbstub/test-sve.py')],
+    },
+    'sve-ioctls.c': {
+      'gdb_test': ['--test', files('gdbstub/test-sve-ioctl.py')],
+    },
+  }
+endif
+
+if cc_has_feat['sme']
+  f = feat_cflags['sme']
+  sysregs_sme = 'sysregs-sme'
+  tests += {
+    'sysregs.c': {
+      'exe_name': sysregs_sme,
+      'cflags': f,
+      'gdb_test': ['--test', files('gdbstub/test-sme.py'), '--',
+                   'test_sme', '--gdb_basic_za_test'],
+    }
+  }
+  if gdb_has_feat['sme-tiles']
+    tests += {
+      'sysregs.c': {
+        'test_name': 'sysregs-sme-tile-slice',
+        'exe_name': sysregs_sme,
+        'gdb_test': ['--test', files('gdbstub/test-sme.py'), '--',
+                     'test_sme', '--gdb_tile_slice_test'],
+      }
+    }
+  endif
+  tests += {
+    'sysregs.c': {
+      'test_name': 'sysregs-sme2',
+      'exe_name': sysregs_sme,
+      'gdb_test': ['--test', files('gdbstub/test-sme2.py')],
+    }
+  }
+endif
+
+if cc_has_feat['mte'] and gdb_has_feat['mte']
+  f = feat_cflags['mte']
+  tests += {
+    'mte-8.c': {
+      'gdb_test': ['--test', files('gdbstub/test-mte.py'), '--', '--mode=user'],
+    }
+  }
+endif
+
+tcg_tests += {
+  'aarch64-linux-user': {
+    'cc': cc,
+    'folder': 'aarch64',
+    'gdb_arch': 'aarch64',
+    'qemu': emulators['qemu-aarch64'],
+    'tests': tests,
+  }
+}
diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index fbccf72f686..0036203a311 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -69,6 +69,9 @@ endif
 test_plugins = {}
 subdir('plugins')
 
+# Now let's go through all architectures
+subdir('aarch64')
+
 # Finally, we can create all test executables and test targets
 foreach target, plan: tcg_tests
   # Detect duplicated executables/tests, and report an error to force user to
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 22/37] tests/tcg/aarch64: add system tests
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (20 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 21/37] tests/tcg/aarch64: add user tests Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 23/37] tests/tcg/multiarch: declare user tests Pierrick Bouvier
                   ` (15 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

Let's continue with system tests. Take note of how we don't generate
intermediate (common) objects, but instead provide a single build
command for every test, embedding all dependencies.

Besides reducing boilerplate, this makes sure we track correctly all the
dependencies for a given test. Compilation time difference is invisible.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/aarch64/meson.build        |  2 +
 tests/tcg/aarch64/system/meson.build | 69 ++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+)
 create mode 100644 tests/tcg/aarch64/system/meson.build

diff --git a/tests/tcg/aarch64/meson.build b/tests/tcg/aarch64/meson.build
index 9c42b129551..e6cf5309649 100644
--- a/tests/tcg/aarch64/meson.build
+++ b/tests/tcg/aarch64/meson.build
@@ -43,6 +43,8 @@ foreach feat, min_ver : gdb_feat_version
   endif
 endforeach
 
+subdir('system')
+
 if 'qemu-aarch64' not in emulators
   subdir_done()
 endif
diff --git a/tests/tcg/aarch64/system/meson.build b/tests/tcg/aarch64/system/meson.build
new file mode 100644
index 00000000000..a1edf1b8442
--- /dev/null
+++ b/tests/tcg/aarch64/system/meson.build
@@ -0,0 +1,69 @@
+if 'qemu-system-aarch64' not in emulators
+  subdir_done()
+endif
+
+tests = []
+
+minilib_dir = meson.current_source_dir() / '..' / '..' / 'minilib'
+minilib_printf = files(minilib_dir / 'printf.c')[0]
+link_script = files('kernel.ld')[0]
+boot = files('boot.S')[0]
+cflags = ['-nostdlib',
+          '-Wa,--noexecstack',
+          '-I', minilib_dir, minilib_printf, boot,
+          '-Wl,-T', link_script]
+qemu_base_args = ['-display', 'none',
+                  '-semihosting-config', 'enable=on',
+                  '-kernel']
+qemu_def_args = ['-M', 'virt', '-cpu', 'max', qemu_base_args]
+
+tests += {
+  'asid2.c': {'cflags': cflags, 'qemu_args': qemu_def_args},
+  'feat-xs.c': {'cflags': cflags, 'qemu_args': qemu_def_args},
+  'rme_gdi.c': {'cflags': cflags, 'qemu_args': qemu_def_args},
+  'semiheap.c': {'cflags': cflags, 'qemu_args': qemu_def_args},
+  'semiconsole.c': {
+    'cflags': cflags,
+    'qemu_args': ['-serial', 'none', '-chardev', 'stdio,mux=on,id=stdio0',
+                  '-semihosting-config', 'enable=on,chardev=stdio0',
+                  '-mon', 'chardev=stdio0,mode=readline',
+                  qemu_def_args],
+    'wrapper': [prog_run_with_input, 'X']
+  },
+  'vtimer.c': {
+    'cflags': cflags,
+    'qemu_args': ['-M', 'virt,virtualization=on,gic-version=2',
+                  '-cpu', 'cortex-a57', '-smp', '4',
+                  '-semihosting-config', 'enable=on,arg=2',
+                  qemu_base_args]
+  },
+}
+
+if cc_has_feat['v8.3']
+  tests += {
+    'pauth-3.c': {
+      'cflags': [feat_cflags['v8.3'], cflags],
+      'qemu_args': ['-M', 'virt', '-cpu', 'max,pauth-qarma5=on', qemu_base_args],
+    }
+  }
+endif
+
+if cc_has_feat['mte'] and gdb_has_feat['mte-baremetal']
+  tests += {
+    'mte.S': {
+      'cflags': [feat_cflags['mte'], cflags],
+      'qemu_args': ['-M', 'virt,mte=on', '-cpu', 'max', qemu_base_args],
+      'gdb_test': ['--test', files('../gdbstub/test-mte.py'), '--', '--mode=system'],
+    }
+  }
+endif
+
+tcg_tests += {
+  'aarch64-softmmu': {
+    'cc': cc,
+    'folder': 'aarch64/system',
+    'gdb_arch': 'aarch64',
+    'qemu': emulators['qemu-system-aarch64'],
+    'tests': tests,
+  }
+}
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 23/37] tests/tcg/multiarch: declare user tests
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (21 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 22/37] tests/tcg/aarch64: add system tests Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 24/37] tests/tcg/aarch64: add multiarch " Pierrick Bouvier
                   ` (14 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

At this point, those tests are just declared and not used yet.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build           |   7 ++
 tests/tcg/multiarch/meson.build | 147 ++++++++++++++++++++++++++++++++
 tests/tcg/multiarch/sha1.ref    |   1 +
 3 files changed, 155 insertions(+)
 create mode 100644 tests/tcg/multiarch/meson.build
 create mode 100644 tests/tcg/multiarch/sha1.ref

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index 0036203a311..f8234ccf393 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -68,12 +68,19 @@ endif
 # plugins come first, as we need to build the list
 test_plugins = {}
 subdir('plugins')
+# multiarch comes second, so it can be referenced by other arch after
+subdir('multiarch')
 
 # Now let's go through all architectures
 subdir('aarch64')
 
 # Finally, we can create all test executables and test targets
 foreach target, plan: tcg_tests
+  if target.startswith('multiarch-')
+    # those tests are included by architecture files if needed
+    continue
+  endif
+
   # Detect duplicated executables/tests, and report an error to force user to
   # choose how to deal with it.
   built_tests = {}
diff --git a/tests/tcg/multiarch/meson.build b/tests/tcg/multiarch/meson.build
new file mode 100644
index 00000000000..99af41b3fcc
--- /dev/null
+++ b/tests/tcg/multiarch/meson.build
@@ -0,0 +1,147 @@
+tests = []
+
+float_helpers = files('libs/float_helpers.c')[0]
+float_cflags = [float_helpers, '-lm']
+
+# GCC versions 12/13/14/15 at least incorrectly complain about
+# "'SHA1Transform' reading 64 bytes from a region of size 0"; see the gcc bug
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106709
+# Since this is just a standard piece of library code we've borrowed for a
+# TCG test case, suppress the warning rather than trying to modify the
+# code to work around the compiler.
+sha1_cflags = ['-Wno-stringop-overread', '-Wno-unknown-warning-option']
+
+# multiarch src path are written to be included from any other arch folder,
+# so all arch can directly add those tests without any modification.
+multiarch = meson.current_source_dir()
+
+tests += {
+  multiarch/'catch-syscalls.c': {},
+  multiarch/'float_convd.c': {
+    'cflags': float_cflags,
+    'expected_output': 'float_convd.ref',
+  },
+  multiarch/'float_convs.c': {
+    'cflags': float_cflags,
+    'expected_output': 'float_convs.ref',
+  },
+  multiarch/'float_madds.c': {
+    'cflags': float_cflags,
+    'expected_output': 'float_madds.ref',
+  },
+  multiarch/'fnmsub.c': {'cflags': ['-lm']},
+  multiarch/'follow-fork-mode.c': {},
+  multiarch/'late-attach.c': {},
+  multiarch/'munmap-pthread.c': {'cflags': ['-lpthread']},
+  multiarch/'overflow.c': {},
+  multiarch/'prot-none.c': {},
+  multiarch/'segfault.c': {},
+  multiarch/'sha1.c': {
+    'cflags': sha1_cflags,
+    'expected_output': multiarch/'sha1.ref'
+  },
+  multiarch/'sha512.c': {},
+  multiarch/'sigbus.c': {},
+  multiarch/'signals.c': {'cflags': ['-lrt', '-lpthread']},
+  multiarch/'sigreturn-sigmask.c': {'cflags': ['-lpthread']},
+  multiarch/'tb-link.c': {'cflags': ['-lpthread']},
+  multiarch/'test-mmap.c': {},
+  multiarch/'testthread.c': {'cflags': ['-lpthread']},
+  multiarch/'threadcount.c': {'cflags': ['-lpthread']},
+}
+
+# Linux tests
+tests += {
+  multiarch/'linux/linux-madvise.c': {},
+  multiarch/'linux/linux-shmat-maps.c': {},
+  multiarch/'linux/linux-shmat-null.c': {},
+  multiarch/'linux/linux-sigrtminmax.c': {},
+  multiarch/'linux/linux-test.c': {},
+  multiarch/'linux/test-vma.c': {},
+}
+
+# GDB tests
+tests += {
+  multiarch/'sha1.c': {
+    'gdb_test': ['--test', files('gdbstub/sha1.py')],
+  },
+}
+tests += {
+  multiarch/'sha1.c': {
+    'test_name': 'qxfer-auxv-read',
+    'gdb_test': ['--test', files('gdbstub/test-qxfer-auxv-read.py')],
+  },
+}
+tests += {
+  multiarch/'sha1.c': {
+    'test_name': 'proc-mappings',
+    'gdb_test': ['--test', files('gdbstub/test-proc-mappings.py')],
+  },
+}
+tests += {
+  multiarch/'segfault.c': {
+    'test_name': 'qxfer-siginfo-read',
+    'gdb_test': ['--test', files('gdbstub/test-qxfer-siginfo-read.py')],
+  },
+  multiarch/'testthread.c': {
+    'test_name': 'thread-breakpoint',
+    'gdb_test': ['--test', files('gdbstub/test-thread-breakpoint.py')],
+  },
+  multiarch/'sha512.c': {
+    'test_name': 'registers',
+    'gdb_test': ['--test', files('gdbstub/registers.py')],
+  },
+  multiarch/'prot-none.c': {
+    'gdb_test': ['--test', files('gdbstub/prot-none.py')],
+    'env_var': 'PROT_NONE_PY=1',
+  },
+  multiarch/'catch-syscalls.c': {
+    'gdb_test': ['--test', files('gdbstub/catch-syscalls.py')],
+  },
+  multiarch/'late-attach.c': {
+    'gdb_test': ['--no-suspend', '--test', files('gdbstub/late-attach.py')],
+    'env_var': 'LATE_ATTACH_PY=1',
+  },
+}
+
+tests += {
+  multiarch/'follow-fork-mode.c': {
+    'test_name': 'follow-fork-mode-child',
+    'gdb_test': ['--test', files('gdbstub/follow-fork-mode-child.py')],
+  },
+}
+tests += {
+  multiarch/'follow-fork-mode.c': {
+    'test_name': 'follow-fork-mode-parent',
+    'gdb_test': ['--test', files('gdbstub/follow-fork-mode-parent.py')],
+  },
+}
+
+# Specific plugin tests
+# Test plugin memory access instrumentation
+tests += {
+  multiarch/'plugin/test-plugin-mem-access.c': {
+    'plugin_test': {
+      'plugin': 'mem',
+      'args': ['print-accesses=true']
+    },
+    'wrapper': [prog_check_plugin_output,
+                find_program('plugin/regex-compare.sh')],
+  },
+  multiarch/'plugin/test-plugin-set-pc.c': {
+    'plugin_test': {
+      'plugin': 'setpc',
+    }
+  },
+  multiarch/'test-plugin-syscall-filter.c': {
+    'plugin_test': {
+      'plugin': 'syscall',
+    }
+  },
+}
+
+tcg_tests += {
+  'multiarch-linux-user': {
+    'tests': tests
+  }
+}
diff --git a/tests/tcg/multiarch/sha1.ref b/tests/tcg/multiarch/sha1.ref
new file mode 100644
index 00000000000..4a8a114634f
--- /dev/null
+++ b/tests/tcg/multiarch/sha1.ref
@@ -0,0 +1 @@
+SHA1=15dd99a1991e0b3826fede3deffc1feba42278e6
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 24/37] tests/tcg/aarch64: add multiarch user tests
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (22 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 23/37] tests/tcg/multiarch: declare user tests Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 25/37] tests/tcg/multiarch: declare system tests Pierrick Bouvier
                   ` (13 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

We can now add multiarch tests. We also take care of semihosting tests
here, by including them explicitly, instead of relying on any kind of
"per-target" config.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/aarch64/meson.build | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/tests/tcg/aarch64/meson.build b/tests/tcg/aarch64/meson.build
index e6cf5309649..53085278155 100644
--- a/tests/tcg/aarch64/meson.build
+++ b/tests/tcg/aarch64/meson.build
@@ -51,6 +51,9 @@ endif
 
 tests = []
 
+# Multi arch tests
+tests += tcg_tests['multiarch-linux-user']['tests']
+
 # Base architecture tests
 tests += {
   '../arm/fcvt.c': {'cflags': '-lm', 'expected_output': 'fcvt.ref'},
@@ -136,11 +139,29 @@ tests += {'sysregs.c': {}}
 # Crypto Tests
 tests += {'test-aes.c': {'cflags': feat_cflags['aes']}}
 
+# Vector SHA1
+# Work around compiler false-positive warning, as we do for the 'sha1' test
+tests += {'../multiarch/sha1.c': {
+            'exe_name': 'sha1-vector',
+            'cflags': ['-O3', '-Wno-stringop-overread'],
+            'expected_output': '../multiarch/sha1.ref',
+         }}
+
+# Vector versions of sha512 (-O3 triggers vectorisation)
+tests += {'../multiarch/sha512.c': {
+            'exe_name': 'sha512-vector',
+            'cflags': ['-O3'],
+         }}
+
 # SVE Tests
 if cc_has_feat['sve']
   f = feat_cflags['sve']
   tests += {
     'sve-ioctls.c': {'cflags': f},
+    '../multiarch/sha512.c': {
+       'exe_name': 'sha512-sve',
+       'cflags': f,
+    },
     'sve-str.c': {'cflags': [f, '-O1']},
   }
 endif
@@ -204,6 +225,18 @@ if cc_has_feat['mte'] and gdb_has_feat['mte']
   }
 endif
 
+# Semihosting tests
+# Add -I path for semicall.h
+semihosting_cflags = ['-I', meson.current_source_dir()]
+
+tests += {
+  '../multiarch/arm-compat-semi/semiconsole.c': {
+    'cflags': semihosting_cflags,
+    'wrapper': [prog_run_with_input, 'X'],
+  },
+  '../multiarch/arm-compat-semi/semihosting.c': {'cflags': semihosting_cflags},
+}
+
 tcg_tests += {
   'aarch64-linux-user': {
     'cc': cc,
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 25/37] tests/tcg/multiarch: declare system tests
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (23 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 24/37] tests/tcg/aarch64: add multiarch " Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 26/37] tests/tcg/aarch64: add multiarch " Pierrick Bouvier
                   ` (12 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

We now declare all multiarch system tests.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/multiarch/meson.build        |  2 +
 tests/tcg/multiarch/system/meson.build | 53 ++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100644 tests/tcg/multiarch/system/meson.build

diff --git a/tests/tcg/multiarch/meson.build b/tests/tcg/multiarch/meson.build
index 99af41b3fcc..508fdb585b7 100644
--- a/tests/tcg/multiarch/meson.build
+++ b/tests/tcg/multiarch/meson.build
@@ -1,3 +1,5 @@
+subdir('system')
+
 tests = []
 
 float_helpers = files('libs/float_helpers.c')[0]
diff --git a/tests/tcg/multiarch/system/meson.build b/tests/tcg/multiarch/system/meson.build
new file mode 100644
index 00000000000..f71c12db38e
--- /dev/null
+++ b/tests/tcg/multiarch/system/meson.build
@@ -0,0 +1,53 @@
+tests = []
+
+# multiarch src path are written to be included from any other arch folder,
+# so all arch can directly add those tests.
+multiarch = meson.current_source_dir()
+
+tests += {
+  multiarch/'hello.c': {},
+  multiarch/'interrupt.c': {},
+  multiarch/'memory.c': {},
+}
+
+tests += {
+  multiarch/'memory.c': {
+    'gdb_test': ['--test', files('../gdbstub/memory.py')]
+  },
+  multiarch/'interrupt.c': {
+    'gdb_test': ['--test', files('../gdbstub/interrupt.py')]
+  },
+  multiarch/'hello.c': {
+    'test_name': 'untimely-packet',
+    'gdb_test': ['--gdb-args',  '-ex \'set debug remote 1\'',
+                 '--output', '/dev/stdout',
+                 '--stderr', '/dev/stdout'],
+    'wrapper': [prog_run_and_check_forbidden_output,
+                'Packet instead of Ack, ignoring it']
+  }
+}
+
+tests += {
+  multiarch/'memory.c': {
+    'test_name': 'registers',
+    'gdb_test': ['--test', files('../gdbstub/registers.py')]
+  }
+}
+
+tests += {
+  multiarch/'memory.c': {
+    'test_name': 'memory-access',
+    'plugin_test': {
+      'plugin': 'mem',
+      'args': ['region-summary=true'],
+    },
+    'wrapper': [prog_check_plugin_output,
+                find_program('./validate-memory-counts.py')]
+  }
+}
+
+tcg_tests += {
+  'multiarch-softmmu': {
+    'tests': tests
+  }
+}
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 26/37] tests/tcg/aarch64: add multiarch system tests
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (24 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 25/37] tests/tcg/multiarch: declare system tests Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 27/37] tests/tcg/meson.build: add generic plugin tests Pierrick Bouvier
                   ` (11 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

We can now add multiarch system tests. Because of our policy to not
repeat cflags, we must make sure we only add those once per executable.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/aarch64/system/meson.build | 31 ++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/tests/tcg/aarch64/system/meson.build b/tests/tcg/aarch64/system/meson.build
index a1edf1b8442..2a613cca52d 100644
--- a/tests/tcg/aarch64/system/meson.build
+++ b/tests/tcg/aarch64/system/meson.build
@@ -17,6 +17,32 @@ qemu_base_args = ['-display', 'none',
                   '-kernel']
 qemu_def_args = ['-M', 'virt', '-cpu', 'max', qemu_base_args]
 
+# Multi arch tests - add cflags only once per src
+multi_src = []
+foreach t: tcg_tests['multiarch-softmmu']['tests']
+  foreach src, setup: t
+    new_cflags = cflags
+    if fs.stem(src) == 'memory'
+      new_cflags += '-DCHECK_UNALIGNED=1'
+    endif
+    if src not in multi_src
+      setup += {'cflags': [new_cflags]}
+      multi_src += src
+    endif
+    tests += {src: setup + {'qemu_args': qemu_def_args}}
+  endforeach
+endforeach
+
+if cc_has_feat['sve']
+  tests += {
+    '../../multiarch/system/memory.c': {
+      'exe_name': 'memory-sve',
+      'cflags': [cflags, feat_cflags['sve'], '-DCHECK_UNALIGNED=1', '-O3'],
+      'qemu_args': qemu_def_args,
+    },
+  }
+endif
+
 tests += {
   'asid2.c': {'cflags': cflags, 'qemu_args': qemu_def_args},
   'feat-xs.c': {'cflags': cflags, 'qemu_args': qemu_def_args},
@@ -30,6 +56,11 @@ tests += {
                   qemu_def_args],
     'wrapper': [prog_run_with_input, 'X']
   },
+  '../../multiarch/system/memory.c': {
+    'test_name': 'memory-record-replay',
+    'qemu_args': qemu_def_args,
+    'wrapper': [prog_record_replay],
+  },
   'vtimer.c': {
     'cflags': cflags,
     'qemu_args': ['-M', 'virt,virtualization=on,gic-version=2',
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 27/37] tests/tcg/meson.build: add generic plugin tests
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (25 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 26/37] tests/tcg/aarch64: add multiarch " Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 28/37] tests/tcg/meson.build: add logic to skip tests Pierrick Bouvier
                   ` (10 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

We finally run every multiarch test (user & system) with every plugin we
have. We can implement another strategy easily, the point here is just
to show how we can do this without impacting test definitions files.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index f8234ccf393..0f0a2b578af 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -71,6 +71,42 @@ subdir('plugins')
 # multiarch comes second, so it can be referenced by other arch after
 subdir('multiarch')
 
+# Generic Plugin tests - add plugin for every user/system multiarch test
+plugin_tests_exclude = ['patch']
+foreach target: ['multiarch-linux-user', 'multiarch-softmmu']
+  plugin_tests = []
+  tests = tcg_tests[target]['tests']
+
+  foreach plugin_name, _: test_plugins
+    if plugin_name in plugin_tests_exclude
+      continue
+    endif
+
+    foreach t: tests
+      foreach src, setup: t
+        if 'plugin_test' in setup or 'gdb_test' in setup
+          continue
+        endif
+
+        # copy existing setup and remove existing cflags
+        new_setup = {}
+        foreach key, val: setup
+          if key == 'cflags'
+            continue
+          endif
+          new_setup += {key: val}
+        endforeach
+
+        new_setup += {'plugin_test': {'plugin': plugin_name}}
+        plugin_tests += {src: new_setup}
+      endforeach
+    endforeach
+  endforeach
+
+  # replace list of tests with old and new ones
+  tcg_tests += {target: {'tests': tests + plugin_tests}}
+endforeach
+
 # Now let's go through all architectures
 subdir('aarch64')
 
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 28/37] tests/tcg/meson.build: add logic to skip tests
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (26 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 27/37] tests/tcg/meson.build: add generic plugin tests Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 29/37] tests/tcg/meson.build: introduce cc_feat and cc_feat_cflags Pierrick Bouvier
                   ` (9 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

Instead of skipping tests and not declare them, always declare them and
simply return an exit code 77 (SKIPPED for meson) and print reason why
test is skipped.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index 0f0a2b578af..17996561798 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -161,11 +161,15 @@ foreach target, plan: tcg_tests
         endforeach
       endif
 
+      # if set, we'll skip test and print the reason
+      skip_test = ''
+
       if 'gdb_test' in setup and gdb_arch not in gdb_arch_supported
         continue
       endif
 
       if 'plugin_test' in setup and not get_option('plugins')
+        # do not use the skip_test logic, and simply ignore the test
         continue
       endif
 
@@ -273,6 +277,11 @@ foreach target, plan: tcg_tests
         cmd = [setup['env_var'], cmd]
       endif
 
+      if skip_test != ''
+        # still declare test, but skip it and print reason
+        cmd = ['sh', '-c', 'echo "' + skip_test + '" && exit 77']
+      endif
+
       test(test_name, env, args: cmd,
            depends: depends,
            suite: ['tcg', 'tcg-' + target])
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 29/37] tests/tcg/meson.build: introduce cc_feat and cc_feat_cflags
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (27 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 28/37] tests/tcg/meson.build: add logic to skip tests Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 30/37] tests/tcg/meson.build: introduce gdb_feat and gdb_feat_version Pierrick Bouvier
                   ` (8 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

We directly move compiler requirements in test definition. This allows
to always declare all tests, and let the main loop filter the ones
that will be available.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build | 43 +++++++++++++++++++++++++++++++++++++------
 1 file changed, 37 insertions(+), 6 deletions(-)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index 17996561798..f4ccfb0bd84 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -21,6 +21,10 @@ tcg_tests = {}
 # {
 #   'name_of_target': {
 #     'cc': cross_compiler,
+#     'cc_feat_cflags': {
+#       'name': ['feature cflags'],
+#       ...
+#     },
 #     'folder': 'folder_for_test_src_files',
 #     'gdb_arch': 'gdb architecture requirement',
 #     'qemu': emulators['qemu-...'],
@@ -30,6 +34,7 @@ tcg_tests = {}
 #           'exe_name': ['provide an alternative binary name'],
 #           'test_name': ['provide an alternative test name'],
 #           'cflags': ['additional cflags to compile test', ...],
+#           'cc_feat': 'feature name, must be present in cc_feat_cflags',
 #           'qemu_args': ['qemu command line flags', ...],
 #           'expected_output': 'file_to_compare_output',
 #           'gdb_test': ['gdb test args'],
@@ -121,10 +126,11 @@ foreach target, plan: tcg_tests
   # choose how to deal with it.
   built_tests = {}
   added_tests = {}
+  cc_has_feat = {}
 
   # return a clear error if user misspell a target entry
   foreach key, _ : plan
-    allowed = ['cc', 'folder', 'gdb_arch', 'qemu', 'tests']
+    allowed = ['cc', 'cc_feat_cflags', 'folder', 'gdb_arch', 'qemu', 'tests']
     if key not in allowed
       error('unknown tcg test plan entry \'' + key + '\' for target ' + target +
             ' (possible: [' + ', '.join(allowed) + '])')
@@ -135,13 +141,17 @@ foreach target, plan: tcg_tests
   folder = plan['folder']
   gdb_arch = plan['gdb_arch']
   qemu = plan['qemu']
+  cc_feat_cflags = {}
+  if 'cc_feat_cflags' in plan
+    cc_feat_cflags = plan['cc_feat_cflags']
+  endif
   tests = plan['tests']
 
   foreach t : tests
     foreach src, setup: t
       # return a clear error if user misspell a setup entry
       foreach key, _ : setup
-        allowed = ['exe_name', 'env_var', 'expected_output', 'cflags',
+        allowed = ['exe_name', 'env_var', 'expected_output', 'cc_feat', 'cflags',
                    'gdb_test', 'plugin_test', 'qemu_args', 'test_name',
                    'wrapper']
         if key not in allowed
@@ -202,15 +212,36 @@ foreach target, plan: tcg_tests
               'specify a different \'test_name\'')
       endif
 
+      if 'cflags' in setup or 'cc_feat' in setup
+        if exe_name in built_tests
+          error('test ' + exe_name +
+                ' was already built with cflags or cc_feat:' +
+                ' remove cflags, cc_feat, or set \'exe_name\'' +
+                ' (if cflags are different)')
+        endif
+      endif
+
       cflags = []
       if 'cflags' in setup
-        if exe_name in built_tests
-          error('test ' + exe_name + ' was already built with cflags: ' +
-                'remove cflags or set \'exe_name\' (if cflags are different)')
-        endif
         cflags = setup['cflags']
       endif
 
+      if 'cc_feat' in setup
+        cc_feat = setup['cc_feat']
+        if cc_feat not in cc_has_feat
+          cmd = run_command([cc, cc_check_args, cc_feat_cflags[cc_feat]],
+                            check: false)
+          avail = cmd.returncode() == 0
+          cc_has_feat += {cc_feat: avail}
+        endif
+
+        if not cc_has_feat[cc_feat]
+          skip_test = 'compiler feature ' + cc_feat + ' not supported'
+          built_tests += {exe_name: exe_name}
+        endif
+        cflags += cc_feat_cflags[cc_feat]
+      endif
+
       # build executable if needed
       if exe_name not in built_tests
         exe = custom_target(exe_name,
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 30/37] tests/tcg/meson.build: introduce gdb_feat and gdb_feat_version
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (28 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 29/37] tests/tcg/meson.build: introduce cc_feat and cc_feat_cflags Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 31/37] tests/tcg/meson.build: move gdb_arch support check Pierrick Bouvier
                   ` (7 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

Similar to cc features, we declare the same for gdb. With both
available, we can now declare all tests inconditionally.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index f4ccfb0bd84..80743c2ecd6 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -27,6 +27,10 @@ tcg_tests = {}
 #     },
 #     'folder': 'folder_for_test_src_files',
 #     'gdb_arch': 'gdb architecture requirement',
+#     'gdb_feat_version': {
+#       'name': ['minimal gdb version supporting feature'],
+#       ...
+#     },
 #     'qemu': emulators['qemu-...'],
 #     'tests': [
 #       {
@@ -38,6 +42,7 @@ tcg_tests = {}
 #           'qemu_args': ['qemu command line flags', ...],
 #           'expected_output': 'file_to_compare_output',
 #           'gdb_test': ['gdb test args'],
+#           'gdb_feat': ['feature name, must be present in gdb_feat_version'],
 #           'env_var': ['VAR=value', ...],
 #           'wrapper': [program_to_launch_test, 'args'...],
 #           'plugin_test': {
@@ -130,7 +135,8 @@ foreach target, plan: tcg_tests
 
   # return a clear error if user misspell a target entry
   foreach key, _ : plan
-    allowed = ['cc', 'cc_feat_cflags', 'folder', 'gdb_arch', 'qemu', 'tests']
+    allowed = ['cc', 'cc_feat_cflags', 'folder', 'gdb_arch', 'gdb_feat_version',
+               'qemu', 'tests']
     if key not in allowed
       error('unknown tcg test plan entry \'' + key + '\' for target ' + target +
             ' (possible: [' + ', '.join(allowed) + '])')
@@ -145,6 +151,11 @@ foreach target, plan: tcg_tests
   if 'cc_feat_cflags' in plan
     cc_feat_cflags = plan['cc_feat_cflags']
   endif
+  gdb_feat_version = {}
+  if 'gdb_feat_version' in plan
+    gdb_feat_version = plan['gdb_feat_version']
+  endif
+
   tests = plan['tests']
 
   foreach t : tests
@@ -152,8 +163,8 @@ foreach target, plan: tcg_tests
       # return a clear error if user misspell a setup entry
       foreach key, _ : setup
         allowed = ['exe_name', 'env_var', 'expected_output', 'cc_feat', 'cflags',
-                   'gdb_test', 'plugin_test', 'qemu_args', 'test_name',
-                   'wrapper']
+                   'gdb_feat', 'gdb_test', 'plugin_test', 'qemu_args',
+                   'test_name', 'wrapper']
         if key not in allowed
           error('unknown tcg setup entry \'' + key + '\' for test ' + src +
                 ' (possible: [' + ', '.join(allowed) + '])')
@@ -308,6 +319,18 @@ foreach target, plan: tcg_tests
         cmd = [setup['env_var'], cmd]
       endif
 
+      if 'gdb_feat' in setup
+        if 'gdb_test' not in setup
+          error('test ' + test_name + ' is not a gdb test, but it requires ' +
+                'a gdb feature')
+        endif
+        gdb_feat = setup['gdb_feat']
+
+        if not gdb_version.version_compare('>=' + gdb_feat_version[gdb_feat])
+          skip_test = 'gdb feature ' + gdb_feat + ' not supported'
+        endif
+      endif
+
       if skip_test != ''
         # still declare test, but skip it and print reason
         cmd = ['sh', '-c', 'echo "' + skip_test + '" && exit 77']
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 31/37] tests/tcg/meson.build: move gdb_arch support check
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (29 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 30/37] tests/tcg/meson.build: introduce gdb_feat and gdb_feat_version Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 32/37] tests/tcg/aarch64: delegate cc_feat and gdb_feat Pierrick Bouvier
                   ` (6 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

This allows to report the correct skip reason instead of saying gdb does
not support a specific feature for some tests.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index 80743c2ecd6..54346668eec 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -185,10 +185,6 @@ foreach target, plan: tcg_tests
       # if set, we'll skip test and print the reason
       skip_test = ''
 
-      if 'gdb_test' in setup and gdb_arch not in gdb_arch_supported
-        continue
-      endif
-
       if 'plugin_test' in setup and not get_option('plugins')
         # do not use the skip_test logic, and simply ignore the test
         continue
@@ -329,6 +325,10 @@ foreach target, plan: tcg_tests
         if not gdb_version.version_compare('>=' + gdb_feat_version[gdb_feat])
           skip_test = 'gdb feature ' + gdb_feat + ' not supported'
         endif
+
+        if gdb_arch not in gdb_arch_supported
+          skip_test = 'gdb not available for ' + gdb_arch
+        endif
       endif
 
       if skip_test != ''
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 32/37] tests/tcg/aarch64: delegate cc_feat and gdb_feat
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (30 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 31/37] tests/tcg/meson.build: move gdb_arch support check Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 33/37] tests/tcg/meson.build: let test infrastructure detect compiler Pierrick Bouvier
                   ` (5 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

We can now declare all tests with their requirements.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/aarch64/meson.build        | 227 ++++++++++-----------------
 tests/tcg/aarch64/system/meson.build |  48 +++---
 2 files changed, 111 insertions(+), 164 deletions(-)

diff --git a/tests/tcg/aarch64/meson.build b/tests/tcg/aarch64/meson.build
index 53085278155..f7c0202ed1b 100644
--- a/tests/tcg/aarch64/meson.build
+++ b/tests/tcg/aarch64/meson.build
@@ -4,7 +4,7 @@ if not cc.found()
   subdir_done()
 endif
 
-feat_cflags = {
+cc_feat_cflags = {
   'aes': '-march=armv8-a+aes',
   'sve': '-march=armv8.1-a+sve',
   'sve2': '-march=armv8.1-a+sve2',
@@ -15,33 +15,12 @@ feat_cflags = {
   'mte':  '-march=armv8.5-a+memtag',
   'sme':  '-Wa,-march=armv9-a+sme',
 }
-cc_has_feat = {}
-
-foreach feat, flags : feat_cflags
-  cmd = run_command([cc, cc_check_args, flags], check: false)
-  avail = cmd.returncode() == 0
-  cc_has_feat += {feat: avail}
-  if not avail
-    warning('aarch64 tcg tests for feature \'' + feat + '\' ' +
-            'disabled: unsupported by cross-compiler')
-  endif
-endforeach
 
 gdb_feat_version = {
   'sme-tiles': '14.1',
   'mte': '15.1',
   'mte-baremetal': '16.0',
 }
-gdb_has_feat = {}
-
-foreach feat, min_ver : gdb_feat_version
-  avail = gdb_version.version_compare('>=' + min_ver)
-  gdb_has_feat += {feat: avail}
-  if not avail
-    warning('aarch64 gdb tests for feature \'' + feat + '\' ' +
-            'disabled: unsupported by gdb')
-  endif
-endforeach
 
 subdir('system')
 
@@ -63,68 +42,83 @@ tests += {
   'test-2150.c': {},
 }
 
-if cc_has_feat['v8.2']
-  tests += {'dcpop.c': {'cflags': feat_cflags['v8.2']}}
-endif
-
-if cc_has_feat['v8.5']
-  tests += {'dcpodp.c': {'cflags': feat_cflags['v8.5']}}
-endif
+tests += {'dcpop.c': {'cc_feat': 'v8.2'}}
+tests += {'dcpodp.c': {'cc_feat': 'v8.5'}}
 
 # Pauth Tests
-if cc_has_feat['v8.3']
-  f = feat_cflags['v8.3']
-  cpu_max = ['-cpu', 'max']
-  cpu_neoverse = ['-cpu', 'neoverse-v1']
-  tests += {
-    'test-2375.c': {'cflags': f},
-    'pauth-1.c': {'cflags': f, 'qemu_args': cpu_max},
-    'pauth-2.c': {'cflags': f, 'qemu_args': cpu_max},
-    # Choose a cpu with FEAT_Pauth but without FEAT_FPAC for pauth-[45].
-    'pauth-4.c': {'cflags': f, 'qemu_args': cpu_neoverse},
-    'pauth-5.c': {'cflags': f, 'qemu_args': cpu_neoverse},
-  }
-endif
+cpu_max = ['-cpu', 'max']
+cpu_neoverse = ['-cpu', 'neoverse-v1']
+tests += {
+  'test-2375.c': {'cc_feat': 'v8.3'},
+  'pauth-1.c': {'cc_feat': 'v8.3', 'qemu_args': cpu_max},
+  'pauth-2.c': {'cc_feat': 'v8.3', 'qemu_args': cpu_max},
+  # Choose a cpu with FEAT_Pauth but without FEAT_FPAC for pauth-[45].
+  'pauth-4.c': {'cc_feat': 'v8.3', 'qemu_args': cpu_neoverse},
+  'pauth-5.c': {'cc_feat': 'v8.3', 'qemu_args': cpu_neoverse},
+}
 
 # BTI Tests
 # bti-1 tests the elf notes, so we require special compiler support.
-if cc_has_feat['bti']
-  f = [feat_cflags['bti'], '-fno-stack-protector', '-nostdlib']
-  tests += {
-    'bti-1.c': {'cflags': f},
-    'bti-3.c': {'cflags': f},
-  }
-endif
+f = ['-fno-stack-protector', '-nostdlib']
+tests += {
+  'bti-1.c': {'cc_feat': 'bti', 'cflags': f},
+  'bti-3.c': {'cc_feat': 'bti', 'cflags': f},
+}
 # bti-2 tests PROT_BTI, so no special compiler support required.
 tests += {'bti-2.c': {}}
 
 # MTE Tests
-if cc_has_feat['mte']
-  f = feat_cflags['mte']
-  tests += {
-    'mte-1.c': {'cflags': f},
-    'mte-2.c': {'cflags': f},
-    'mte-3.c': {'cflags': f},
-    'mte-4.c': {'cflags': f},
-    'mte-5.c': {'cflags': f},
-    'mte-6.c': {'cflags': f},
-    'mte-7.c': {'cflags': f},
-    'mte-8.c': {'cflags': f},
+tests += {
+  'mte-1.c': {'cc_feat': 'mte'},
+  'mte-2.c': {'cc_feat': 'mte'},
+  'mte-3.c': {'cc_feat': 'mte'},
+  'mte-4.c': {'cc_feat': 'mte'},
+  'mte-5.c': {'cc_feat': 'mte'},
+  'mte-6.c': {'cc_feat': 'mte'},
+  'mte-7.c': {'cc_feat': 'mte'},
+  'mte-8.c': {'cc_feat': 'mte'},
+}
+tests += {
+  'mte-8.c': {
+    'gdb_test': ['--test', files('gdbstub/test-mte.py'), '--', '--mode=user'],
+    'gdb_feat': 'mte',
   }
-endif
+}
 
 # SME Tests
-if cc_has_feat['sme']
-  f = feat_cflags['sme']
-  tests += {
-    'sme-outprod1.c': {'cflags': f},
-    'sme-smopa-1.c': {'cflags': f},
-    'sme-smopa-2.c': {'cflags': f},
-    'sme-fmopa-1.c': {'cflags': f},
-    'sme-fmopa-2.c': {'cflags': f},
-    'sme-fmopa-3.c': {'cflags': f},
+tests += {
+  'sme-outprod1.c': {'cc_feat': 'sme'},
+  'sme-smopa-1.c': {'cc_feat': 'sme'},
+  'sme-smopa-2.c': {'cc_feat': 'sme'},
+  'sme-fmopa-1.c': {'cc_feat': 'sme'},
+  'sme-fmopa-2.c': {'cc_feat': 'sme'},
+  'sme-fmopa-3.c': {'cc_feat': 'sme'},
+}
+sysregs_sme = 'sysregs-sme'
+tests += {
+  'sysregs.c': {
+    'exe_name': sysregs_sme,
+    'cc_feat': 'sme',
+    'gdb_test': ['--test', files('gdbstub/test-sme.py'), '--',
+                 'test_sme', '--gdb_basic_za_test'],
   }
-endif
+}
+tests += {
+  'sysregs.c': {
+    'test_name': 'sysregs-sme-tile-slice',
+    'exe_name': sysregs_sme,
+    'gdb_test': ['--test', files('gdbstub/test-sme.py'), '--',
+                 'test_sme', '--gdb_tile_slice_test'],
+    'gdb_feat': 'sme-tiles',
+  }
+}
+tests += {
+  'sysregs.c': {
+    'test_name': 'sysregs-sme2',
+    'exe_name': sysregs_sme,
+    'gdb_test': ['--test', files('gdbstub/test-sme2.py')],
+  }
+}
 
 # GCS Tests
 tests += {
@@ -137,7 +131,7 @@ tests += {
 tests += {'sysregs.c': {}}
 
 # Crypto Tests
-tests += {'test-aes.c': {'cflags': feat_cflags['aes']}}
+tests += {'test-aes.c': {'cc_feat': 'aes'}}
 
 # Vector SHA1
 # Work around compiler false-positive warning, as we do for the 'sha1' test
@@ -154,76 +148,27 @@ tests += {'../multiarch/sha512.c': {
          }}
 
 # SVE Tests
-if cc_has_feat['sve']
-  f = feat_cflags['sve']
-  tests += {
-    'sve-ioctls.c': {'cflags': f},
-    '../multiarch/sha512.c': {
-       'exe_name': 'sha512-sve',
-       'cflags': f,
-    },
-    'sve-str.c': {'cflags': [f, '-O1']},
-  }
-endif
+tests += {
+  'sve-ioctls.c': {'cc_feat': 'sve'},
+  '../multiarch/sha512.c': {
+     'exe_name': 'sha512-sve',
+     'cc_feat': 'sve',
+  },
+  'sve-str.c': {'cc_feat': 'sve', 'cflags': ['-O1']},
+}
+tests += {
+  'sysregs.c': {
+    'exe_name': 'sysregs-sve',
+    'cc_feat': 'sve',
+    'gdb_test': ['--test', files('gdbstub/test-sve.py')],
+  },
+  'sve-ioctls.c': {
+    'gdb_test': ['--test', files('gdbstub/test-sve-ioctl.py')],
+  },
+}
 
 # SVE2 Tests
-if cc_has_feat['sve2']
-  tests += {'test-826.c': {'cflags': feat_cflags['sve2']}}
-endif
-
-# GDB Tests
-if cc_has_feat['sve']
-  f = feat_cflags['sve']
-  tests += {
-    'sysregs.c': {
-      'exe_name': 'sysregs-sve',
-      'cflags': f,
-      'gdb_test': ['--test', files('gdbstub/test-sve.py')],
-    },
-    'sve-ioctls.c': {
-      'gdb_test': ['--test', files('gdbstub/test-sve-ioctl.py')],
-    },
-  }
-endif
-
-if cc_has_feat['sme']
-  f = feat_cflags['sme']
-  sysregs_sme = 'sysregs-sme'
-  tests += {
-    'sysregs.c': {
-      'exe_name': sysregs_sme,
-      'cflags': f,
-      'gdb_test': ['--test', files('gdbstub/test-sme.py'), '--',
-                   'test_sme', '--gdb_basic_za_test'],
-    }
-  }
-  if gdb_has_feat['sme-tiles']
-    tests += {
-      'sysregs.c': {
-        'test_name': 'sysregs-sme-tile-slice',
-        'exe_name': sysregs_sme,
-        'gdb_test': ['--test', files('gdbstub/test-sme.py'), '--',
-                     'test_sme', '--gdb_tile_slice_test'],
-      }
-    }
-  endif
-  tests += {
-    'sysregs.c': {
-      'test_name': 'sysregs-sme2',
-      'exe_name': sysregs_sme,
-      'gdb_test': ['--test', files('gdbstub/test-sme2.py')],
-    }
-  }
-endif
-
-if cc_has_feat['mte'] and gdb_has_feat['mte']
-  f = feat_cflags['mte']
-  tests += {
-    'mte-8.c': {
-      'gdb_test': ['--test', files('gdbstub/test-mte.py'), '--', '--mode=user'],
-    }
-  }
-endif
+tests += {'test-826.c': {'cc_feat': 'sve2'}}
 
 # Semihosting tests
 # Add -I path for semicall.h
@@ -240,8 +185,10 @@ tests += {
 tcg_tests += {
   'aarch64-linux-user': {
     'cc': cc,
+    'cc_feat_cflags': cc_feat_cflags,
     'folder': 'aarch64',
     'gdb_arch': 'aarch64',
+    'gdb_feat_version': gdb_feat_version,
     'qemu': emulators['qemu-aarch64'],
     'tests': tests,
   }
diff --git a/tests/tcg/aarch64/system/meson.build b/tests/tcg/aarch64/system/meson.build
index 2a613cca52d..8242580bf6d 100644
--- a/tests/tcg/aarch64/system/meson.build
+++ b/tests/tcg/aarch64/system/meson.build
@@ -33,15 +33,14 @@ foreach t: tcg_tests['multiarch-softmmu']['tests']
   endforeach
 endforeach
 
-if cc_has_feat['sve']
-  tests += {
-    '../../multiarch/system/memory.c': {
-      'exe_name': 'memory-sve',
-      'cflags': [cflags, feat_cflags['sve'], '-DCHECK_UNALIGNED=1', '-O3'],
-      'qemu_args': qemu_def_args,
-    },
-  }
-endif
+tests += {
+  '../../multiarch/system/memory.c': {
+    'exe_name': 'memory-sve',
+    'cc_feat': 'sve',
+    'cflags': [cflags, '-DCHECK_UNALIGNED=1', '-O3'],
+    'qemu_args': qemu_def_args,
+  },
+}
 
 tests += {
   'asid2.c': {'cflags': cflags, 'qemu_args': qemu_def_args},
@@ -70,30 +69,31 @@ tests += {
   },
 }
 
-if cc_has_feat['v8.3']
-  tests += {
-    'pauth-3.c': {
-      'cflags': [feat_cflags['v8.3'], cflags],
-      'qemu_args': ['-M', 'virt', '-cpu', 'max,pauth-qarma5=on', qemu_base_args],
-    }
+tests += {
+  'pauth-3.c': {
+    'cc_feat': 'v8.3',
+    'cflags': cflags,
+    'qemu_args': ['-M', 'virt', '-cpu', 'max,pauth-qarma5=on', qemu_base_args],
   }
-endif
+}
 
-if cc_has_feat['mte'] and gdb_has_feat['mte-baremetal']
-  tests += {
-    'mte.S': {
-      'cflags': [feat_cflags['mte'], cflags],
-      'qemu_args': ['-M', 'virt,mte=on', '-cpu', 'max', qemu_base_args],
-      'gdb_test': ['--test', files('../gdbstub/test-mte.py'), '--', '--mode=system'],
-    }
+tests += {
+  'mte.S': {
+    'cc_feat': 'mte',
+    'cflags': cflags,
+    'qemu_args': ['-M', 'virt,mte=on', '-cpu', 'max', qemu_base_args],
+    'gdb_test': ['--test', files('../gdbstub/test-mte.py'), '--', '--mode=system'],
+    'gdb_feat': 'mte-baremetal',
   }
-endif
+}
 
 tcg_tests += {
   'aarch64-softmmu': {
     'cc': cc,
+    'cc_feat_cflags': cc_feat_cflags,
     'folder': 'aarch64/system',
     'gdb_arch': 'aarch64',
+    'gdb_feat_version': gdb_feat_version,
     'qemu': emulators['qemu-system-aarch64'],
     'tests': tests,
   }
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 33/37] tests/tcg/meson.build: let test infrastructure detect compiler
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (31 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 32/37] tests/tcg/aarch64: delegate cc_feat and gdb_feat Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 34/37] tests/docker/docker.py: return error code if probe fails Pierrick Bouvier
                   ` (4 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

Now we moved back flags to tests/tcg/meson.build, we don't need to
expose cc anymore in target files.
This will allow us to easily introduce cross containers.
Also, we can reuse the skip_test logic to gracefully report why tests
don't run.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/aarch64/meson.build |  6 +-----
 tests/tcg/meson.build         | 18 +++++++++++++-----
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/tests/tcg/aarch64/meson.build b/tests/tcg/aarch64/meson.build
index f7c0202ed1b..9baf98bc054 100644
--- a/tests/tcg/aarch64/meson.build
+++ b/tests/tcg/aarch64/meson.build
@@ -1,8 +1,4 @@
-cc = find_program('aarch64-linux-gnu-gcc', required : false)
-
-if not cc.found()
-  subdir_done()
-endif
+cc = 'aarch64-linux-gnu-gcc'
 
 cc_feat_cflags = {
   'aes': '-march=armv8-a+aes',
diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index 54346668eec..2a308d8ad32 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -20,7 +20,7 @@ tcg_tests = {}
 #
 # {
 #   'name_of_target': {
-#     'cc': cross_compiler,
+#     'cc': 'cross_compiler',
 #     'cc_feat_cflags': {
 #       'name': ['feature cflags'],
 #       ...
@@ -143,7 +143,7 @@ foreach target, plan: tcg_tests
     endif
   endforeach
 
-  cc = plan['cc']
+  cc = find_program(plan['cc'], required : false)
   folder = plan['folder']
   gdb_arch = plan['gdb_arch']
   qemu = plan['qemu']
@@ -236,9 +236,12 @@ foreach target, plan: tcg_tests
       if 'cc_feat' in setup
         cc_feat = setup['cc_feat']
         if cc_feat not in cc_has_feat
-          cmd = run_command([cc, cc_check_args, cc_feat_cflags[cc_feat]],
-                            check: false)
-          avail = cmd.returncode() == 0
+          avail = false
+          if cc.found()
+            cmd = run_command([cc, cc_check_args, cc_feat_cflags[cc_feat]],
+                              check: false)
+            avail = cmd.returncode() == 0
+          endif
           cc_has_feat += {cc_feat: avail}
         endif
 
@@ -249,6 +252,11 @@ foreach target, plan: tcg_tests
         cflags += cc_feat_cflags[cc_feat]
       endif
 
+      if not cc.found()
+        skip_test = 'compiler ' + plan['cc'] + ' not available'
+        built_tests += {exe_name: exe_name}
+      endif
+
       # build executable if needed
       if exe_name not in built_tests
         exe = custom_target(exe_name,
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 34/37] tests/docker/docker.py: return error code if probe fails
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (32 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 33/37] tests/tcg/meson.build: let test infrastructure detect compiler Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 35/37] tests/tcg/meson.build: introduce cc_dockerfile Pierrick Bouvier
                   ` (3 subsequent siblings)
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

We are not necessarily interested to know which engine is available.
However, parsing "no" as an answer is not intuitive, compared to
read an exit code.

Thus, exit with 1 if no engine is available.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/docker/docker.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 9e18b984f45..6640cebfbec 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -623,6 +623,7 @@ def run(self, args, argv):
             print(" ".join(docker._command))
         except Exception:
             print("no")
+            return 1
 
         return
 
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 35/37] tests/tcg/meson.build: introduce cc_dockerfile
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (33 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 34/37] tests/docker/docker.py: return error code if probe fails Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-30  6:34   ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 36/37] tests/tcg/aarch64: add container support Pierrick Bouvier
                   ` (2 subsequent siblings)
  37 siblings, 1 reply; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

We allow target to declare a dockerfile containing required cc. We reuse
tests/docker/docker.py, and correctly set dependencies for tests on
original dockerfile.

In case we rely on docker, we do not build tests by default anymore.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build | 52 ++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 47 insertions(+), 5 deletions(-)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index 2a308d8ad32..eb6b65c0021 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -1,6 +1,7 @@
 cc_check_args = ['-xc', '/dev/null', '-o', '/dev/null', '-c']
 env = find_program('env')
 
+docker_wrapper = find_program('../docker/docker.py')
 gdb_progs = ['gdb-multiarch', 'gdb']
 if config_host.has_key('GDB')
   gdb_progs = [config_host['GDB'], gdb_progs]
@@ -21,6 +22,7 @@ tcg_tests = {}
 # {
 #   'name_of_target': {
 #     'cc': 'cross_compiler',
+#     'cc_dockerfile': 'name_of_dockerfile',
 #     'cc_feat_cflags': {
 #       'name': ['feature cflags'],
 #       ...
@@ -75,6 +77,9 @@ if gdb.found()
   endforeach
 endif
 
+docker_supported = run_command(docker_wrapper, 'probe',
+                               check: false).returncode() == 0
+
 # plugins come first, as we need to build the list
 test_plugins = {}
 subdir('plugins')
@@ -120,6 +125,7 @@ endforeach
 # Now let's go through all architectures
 subdir('aarch64')
 
+image_targets = {}
 # Finally, we can create all test executables and test targets
 foreach target, plan: tcg_tests
   if target.startswith('multiarch-')
@@ -135,8 +141,8 @@ foreach target, plan: tcg_tests
 
   # return a clear error if user misspell a target entry
   foreach key, _ : plan
-    allowed = ['cc', 'cc_feat_cflags', 'folder', 'gdb_arch', 'gdb_feat_version',
-               'qemu', 'tests']
+    allowed = ['cc', 'cc_dockerfile', 'cc_feat_cflags', 'folder', 'gdb_arch',
+               'gdb_feat_version', 'qemu', 'tests']
     if key not in allowed
       error('unknown tcg test plan entry \'' + key + '\' for target ' + target +
             ' (possible: [' + ', '.join(allowed) + '])')
@@ -144,6 +150,35 @@ foreach target, plan: tcg_tests
   endforeach
 
   cc = find_program(plan['cc'], required : false)
+  cc_from_system = cc.found()
+  has_cc = cc.found()
+  build_test_depends = []
+  build_test_depend_files = []
+
+  if 'cc_dockerfile' in plan
+    cc_dockerfile = plan['cc_dockerfile']
+    dockerfile = files('..'/'docker'/'dockerfiles'/cc_dockerfile + '.docker')
+    image_name = 'image-' + cc_dockerfile
+    if cc_dockerfile not in image_targets
+      cmd = [docker_wrapper, 'build', '-f', dockerfile, '-t', cc_dockerfile]
+      t = custom_target(image_name, command: cmd,
+                        build_by_default: false,
+                        output: 'none')
+      image_targets += {cc_dockerfile: t}
+    endif
+
+    if docker_supported and not has_cc
+      build_test_depends = image_targets[cc_dockerfile]
+      build_test_depend_files = dockerfile
+      mount = meson.project_source_root()
+      mount = mount + ':' + mount
+      here = meson.project_build_root()
+      cc = [docker_wrapper, 'run', '-w', here, '-v', mount,
+            cc_dockerfile, plan['cc']]
+      has_cc = true
+    endif
+  endif
+
   folder = plan['folder']
   gdb_arch = plan['gdb_arch']
   qemu = plan['qemu']
@@ -237,10 +272,14 @@ foreach target, plan: tcg_tests
         cc_feat = setup['cc_feat']
         if cc_feat not in cc_has_feat
           avail = false
-          if cc.found()
+          if cc_from_system
+            # check flag for host cc
             cmd = run_command([cc, cc_check_args, cc_feat_cflags[cc_feat]],
                               check: false)
             avail = cmd.returncode() == 0
+          elif has_cc
+            # docker cc always have feature
+            avail = true
           endif
           cc_has_feat += {cc_feat: avail}
         endif
@@ -252,12 +291,13 @@ foreach target, plan: tcg_tests
         cflags += cc_feat_cflags[cc_feat]
       endif
 
-      if not cc.found()
+      if not has_cc
         skip_test = 'compiler ' + plan['cc'] + ' not available'
         built_tests += {exe_name: exe_name}
       endif
 
       # build executable if needed
+      # build by default only if cc comes from system
       if exe_name not in built_tests
         exe = custom_target(exe_name,
                             input: file,
@@ -269,7 +309,9 @@ foreach target, plan: tcg_tests
                                       cflags],
                             depfile: exe_name + '.d',
                             output: exe_name + '.test',
-                            build_by_default: true)
+                            depends: build_test_depends,
+                            depend_files: build_test_depend_files,
+                            build_by_default: cc_from_system)
         built_tests += {exe_name: exe}
       endif
 
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 36/37] tests/tcg/aarch64: add container support
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (34 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 35/37] tests/tcg/meson.build: introduce cc_dockerfile Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-06-26 23:39 ` [PATCH v2 37/37] tests/tcg/meson.build: add top-level 'tcg-tests' target Pierrick Bouvier
  2026-07-06 22:44 ` [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/aarch64/meson.build        | 2 ++
 tests/tcg/aarch64/system/meson.build | 1 +
 2 files changed, 3 insertions(+)

diff --git a/tests/tcg/aarch64/meson.build b/tests/tcg/aarch64/meson.build
index 9baf98bc054..450cfb3eb81 100644
--- a/tests/tcg/aarch64/meson.build
+++ b/tests/tcg/aarch64/meson.build
@@ -1,4 +1,5 @@
 cc = 'aarch64-linux-gnu-gcc'
+cc_dockerfile = 'debian-all-test-cross'
 
 cc_feat_cflags = {
   'aes': '-march=armv8-a+aes',
@@ -181,6 +182,7 @@ tests += {
 tcg_tests += {
   'aarch64-linux-user': {
     'cc': cc,
+    'cc_dockerfile': cc_dockerfile,
     'cc_feat_cflags': cc_feat_cflags,
     'folder': 'aarch64',
     'gdb_arch': 'aarch64',
diff --git a/tests/tcg/aarch64/system/meson.build b/tests/tcg/aarch64/system/meson.build
index 8242580bf6d..ad214a23a74 100644
--- a/tests/tcg/aarch64/system/meson.build
+++ b/tests/tcg/aarch64/system/meson.build
@@ -90,6 +90,7 @@ tests += {
 tcg_tests += {
   'aarch64-softmmu': {
     'cc': cc,
+    'cc_dockerfile': cc_dockerfile,
     'cc_feat_cflags': cc_feat_cflags,
     'folder': 'aarch64/system',
     'gdb_arch': 'aarch64',
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 37/37] tests/tcg/meson.build: add top-level 'tcg-tests' target
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (35 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 36/37] tests/tcg/aarch64: add container support Pierrick Bouvier
@ 2026-06-26 23:39 ` Pierrick Bouvier
  2026-07-06 22:44 ` [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-26 23:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Pierrick Bouvier, Thomas Huth, Manos Pitsidianakis,
	Richard Henderson, Alex Bennée, Peter Maydell,
	Gustavo Romero, Paolo Bonzini, Daniel P . Berrangé,
	Philippe Mathieu-Daudé, qemu-arm, Alexandre Iooss

Add a target to rebuild all tcg-tests at once.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/tcg/meson.build | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index eb6b65c0021..d24659e7bef 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -126,6 +126,7 @@ endforeach
 subdir('aarch64')
 
 image_targets = {}
+exe_targets = []
 # Finally, we can create all test executables and test targets
 foreach target, plan: tcg_tests
   if target.startswith('multiarch-')
@@ -312,6 +313,7 @@ foreach target, plan: tcg_tests
                             depends: build_test_depends,
                             depend_files: build_test_depend_files,
                             build_by_default: cc_from_system)
+        exe_targets += exe
         built_tests += {exe_name: exe}
       endif
 
@@ -393,3 +395,8 @@ foreach target, plan: tcg_tests
     endforeach
   endforeach
 endforeach
+
+if exe_targets.length() > 0
+  # finally create a top level target to rebuild all tests
+  alias_target('tcg-tests', exe_targets)
+endif
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 35/37] tests/tcg/meson.build: introduce cc_dockerfile
  2026-06-26 23:39 ` [PATCH v2 35/37] tests/tcg/meson.build: introduce cc_dockerfile Pierrick Bouvier
@ 2026-06-30  6:34   ` Pierrick Bouvier
  0 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-06-30  6:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Manos Pitsidianakis, Richard Henderson,
	Alex Bennée, Peter Maydell, Gustavo Romero, Paolo Bonzini,
	Daniel P . Berrangé, Philippe Mathieu-Daudé, qemu-arm,
	Alexandre Iooss

On 6/26/2026 4:39 PM, Pierrick Bouvier wrote:
> We allow target to declare a dockerfile containing required cc. We reuse
> tests/docker/docker.py, and correctly set dependencies for tests on
> original dockerfile.
> 
> In case we rely on docker, we do not build tests by default anymore.
>

Added (coming in v3) cc_docker_arch to specify host architecture for
which the image supports the given cc.

> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
> ---
>  tests/tcg/meson.build | 52 ++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 47 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
> index 2a308d8ad32..eb6b65c0021 100644
> --- a/tests/tcg/meson.build
> +++ b/tests/tcg/meson.build
> @@ -1,6 +1,7 @@
>  cc_check_args = ['-xc', '/dev/null', '-o', '/dev/null', '-c']
>  env = find_program('env')
>  
> +docker_wrapper = find_program('../docker/docker.py')
>  gdb_progs = ['gdb-multiarch', 'gdb']
>  if config_host.has_key('GDB')
>    gdb_progs = [config_host['GDB'], gdb_progs]
> @@ -21,6 +22,7 @@ tcg_tests = {}
>  # {
>  #   'name_of_target': {
>  #     'cc': 'cross_compiler',
> +#     'cc_dockerfile': 'name_of_dockerfile',
>  #     'cc_feat_cflags': {
>  #       'name': ['feature cflags'],
>  #       ...
> @@ -75,6 +77,9 @@ if gdb.found()
>    endforeach
>  endif
>  
> +docker_supported = run_command(docker_wrapper, 'probe',
> +                               check: false).returncode() == 0
> +
>  # plugins come first, as we need to build the list
>  test_plugins = {}
>  subdir('plugins')
> @@ -120,6 +125,7 @@ endforeach
>  # Now let's go through all architectures
>  subdir('aarch64')
>  
> +image_targets = {}
>  # Finally, we can create all test executables and test targets
>  foreach target, plan: tcg_tests
>    if target.startswith('multiarch-')
> @@ -135,8 +141,8 @@ foreach target, plan: tcg_tests
>  
>    # return a clear error if user misspell a target entry
>    foreach key, _ : plan
> -    allowed = ['cc', 'cc_feat_cflags', 'folder', 'gdb_arch', 'gdb_feat_version',
> -               'qemu', 'tests']
> +    allowed = ['cc', 'cc_dockerfile', 'cc_feat_cflags', 'folder', 'gdb_arch',
> +               'gdb_feat_version', 'qemu', 'tests']
>      if key not in allowed
>        error('unknown tcg test plan entry \'' + key + '\' for target ' + target +
>              ' (possible: [' + ', '.join(allowed) + '])')
> @@ -144,6 +150,35 @@ foreach target, plan: tcg_tests
>    endforeach
>  
>    cc = find_program(plan['cc'], required : false)
> +  cc_from_system = cc.found()
> +  has_cc = cc.found()
> +  build_test_depends = []
> +  build_test_depend_files = []
> +
> +  if 'cc_dockerfile' in plan
> +    cc_dockerfile = plan['cc_dockerfile']
> +    dockerfile = files('..'/'docker'/'dockerfiles'/cc_dockerfile + '.docker')
> +    image_name = 'image-' + cc_dockerfile
> +    if cc_dockerfile not in image_targets
> +      cmd = [docker_wrapper, 'build', '-f', dockerfile, '-t', cc_dockerfile]
> +      t = custom_target(image_name, command: cmd,
> +                        build_by_default: false,
> +                        output: 'none')
> +      image_targets += {cc_dockerfile: t}
> +    endif
> +
> +    if docker_supported and not has_cc
> +      build_test_depends = image_targets[cc_dockerfile]
> +      build_test_depend_files = dockerfile
> +      mount = meson.project_source_root()
> +      mount = mount + ':' + mount
> +      here = meson.project_build_root()
> +      cc = [docker_wrapper, 'run', '-w', here, '-v', mount,
> +            cc_dockerfile, plan['cc']]
> +      has_cc = true
> +    endif
> +  endif
> +
>    folder = plan['folder']
>    gdb_arch = plan['gdb_arch']
>    qemu = plan['qemu']
> @@ -237,10 +272,14 @@ foreach target, plan: tcg_tests
>          cc_feat = setup['cc_feat']
>          if cc_feat not in cc_has_feat
>            avail = false
> -          if cc.found()
> +          if cc_from_system
> +            # check flag for host cc
>              cmd = run_command([cc, cc_check_args, cc_feat_cflags[cc_feat]],
>                                check: false)
>              avail = cmd.returncode() == 0
> +          elif has_cc
> +            # docker cc always have feature
> +            avail = true
>            endif
>            cc_has_feat += {cc_feat: avail}
>          endif
> @@ -252,12 +291,13 @@ foreach target, plan: tcg_tests
>          cflags += cc_feat_cflags[cc_feat]
>        endif
>  
> -      if not cc.found()
> +      if not has_cc
>          skip_test = 'compiler ' + plan['cc'] + ' not available'
>          built_tests += {exe_name: exe_name}
>        endif
>  
>        # build executable if needed
> +      # build by default only if cc comes from system
>        if exe_name not in built_tests
>          exe = custom_target(exe_name,
>                              input: file,
> @@ -269,7 +309,9 @@ foreach target, plan: tcg_tests
>                                        cflags],
>                              depfile: exe_name + '.d',
>                              output: exe_name + '.test',
> -                            build_by_default: true)
> +                            depends: build_test_depends,
> +                            depend_files: build_test_depend_files,
> +                            build_by_default: cc_from_system)
>          built_tests += {exe_name: exe}
>        endif
>  



^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 00/37] tests/tcg: run tests with meson
  2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
                   ` (36 preceding siblings ...)
  2026-06-26 23:39 ` [PATCH v2 37/37] tests/tcg/meson.build: add top-level 'tcg-tests' target Pierrick Bouvier
@ 2026-07-06 22:44 ` Pierrick Bouvier
  37 siblings, 0 replies; 40+ messages in thread
From: Pierrick Bouvier @ 2026-07-06 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Manos Pitsidianakis, Richard Henderson,
	Alex Bennée, Peter Maydell, Gustavo Romero, Paolo Bonzini,
	Daniel P . Berrangé, Philippe Mathieu-Daudé, qemu-arm,
	Alexandre Iooss

On 6/26/2026 4:38 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.
> 
> It implements all requirements listed on original thread [1].
> 
> [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 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
> make tcg-tests
> 
> from build folder:
> ./pyvenv/bin/meson test --list --suite tcg
> ninja clean
> ./pyvenv/bin/meson test aarch64-softmmu-asid2 --verbose
> ```
> 
> v2:
> --
> 
> - s/mispell/misspell
> - moved comment about why we remove 'lib' prefix for plugins
> - if user declare a wrong entry in a dictionary, list possible keys
> - build tests by default (with 'all' target), as long as cross compiler is
>   natively installed, to avoid triggering a container build.
> - reword some comments based on reviewers feedback
> - always declare all tests and avoid "per config" errors (no 'if' in arch files)
> - move compiler feature and gdb version checks directly in tests/tcg/meson.build
> - add support for cross containers
> - add top target 'tcg-tests' to rebuild all tests
> 
> Pierrick Bouvier (37):
>   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/tcg/meson.build: add logic to skip tests
>   tests/tcg/meson.build: introduce cc_feat and cc_feat_cflags
>   tests/tcg/meson.build: introduce gdb_feat and gdb_feat_version
>   tests/tcg/meson.build: move gdb_arch support check
>   tests/tcg/aarch64: delegate cc_feat and gdb_feat
>   tests/tcg/meson.build: let test infrastructure detect compiler
>   tests/docker/docker.py: return error code if probe fails
>   tests/tcg/meson.build: introduce cc_dockerfile
>   tests/tcg/aarch64: add container support
>   tests/tcg/meson.build: add top-level 'tcg-tests' target
> 
>  tests/docker/docker.py                        |   1 +
>  tests/meson.build                             |   2 +-
>  tests/tcg/aarch64/meson.build                 | 193 +++++++++
>  tests/tcg/aarch64/system/meson.build          | 101 +++++
>  tests/tcg/meson.build                         | 402 ++++++++++++++++++
>  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             |  15 +
>  tests/tcg/scripts/run_with_input.sh           |  12 +
>  18 files changed, 1019 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
> 

sent v3, with support for all architectures:
https://lore.kernel.org/qemu-devel/20260706223343.988769-1-pierrick.bouvier@oss.qualcomm.com/T/#

Regards,
Pierrick


^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2026-07-06 22:44 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-26 23:38 [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 01/37] tests/tcg/multiarch/system/memory.c: remove unused variable Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 02/37] tests/tcg/multiarch/plugin/check-plugin-output.sh: take test output as input Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 03/37] tests/tcg/multiarch/plugin: rename check-plugin-output to regex-compare Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 04/37] tests/tcg: introduce meson.build Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 05/37] tests/tcg/meson.build: introduce exe_name Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 06/37] tests/tcg/meson.build: introduce test_name Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 07/37] tests/tcg/meson.build: introduce cflags Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 08/37] tests/tcg/meson.build: introduce qemu_args Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 09/37] tests/tcg/meson.build: introduce env_var Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 10/37] tests/tcg/plugins: build list of test_plugins Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 11/37] tests/tcg/meson.build: introduce plugin_test Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 12/37] tests/tcg/meson.build: test gdb support and introduce gdb_arch Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 13/37] tests/tcg/meson.build: introduce gdb_test Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 14/37] tests/tcg/meson.build: add default flag for testing compiler support Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 15/37] tests/tcg/meson.build: introduce wrapper Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 16/37] tests/tcg/meson.build: introduce expected_output Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 17/37] tests/tcg/meson.build: add wrapper run_and_check_forbidden_output Pierrick Bouvier
2026-06-26 23:38 ` [PATCH v2 18/37] tests/tcg/meson.build: add wrapper run_with_input Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 19/37] tests/tcg/meson.build: add wrapper record_replay Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 20/37] tests/tcg/meson.build: add wrapper check_plugin_output Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 21/37] tests/tcg/aarch64: add user tests Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 22/37] tests/tcg/aarch64: add system tests Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 23/37] tests/tcg/multiarch: declare user tests Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 24/37] tests/tcg/aarch64: add multiarch " Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 25/37] tests/tcg/multiarch: declare system tests Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 26/37] tests/tcg/aarch64: add multiarch " Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 27/37] tests/tcg/meson.build: add generic plugin tests Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 28/37] tests/tcg/meson.build: add logic to skip tests Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 29/37] tests/tcg/meson.build: introduce cc_feat and cc_feat_cflags Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 30/37] tests/tcg/meson.build: introduce gdb_feat and gdb_feat_version Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 31/37] tests/tcg/meson.build: move gdb_arch support check Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 32/37] tests/tcg/aarch64: delegate cc_feat and gdb_feat Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 33/37] tests/tcg/meson.build: let test infrastructure detect compiler Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 34/37] tests/docker/docker.py: return error code if probe fails Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 35/37] tests/tcg/meson.build: introduce cc_dockerfile Pierrick Bouvier
2026-06-30  6:34   ` Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 36/37] tests/tcg/aarch64: add container support Pierrick Bouvier
2026-06-26 23:39 ` [PATCH v2 37/37] tests/tcg/meson.build: add top-level 'tcg-tests' target Pierrick Bouvier
2026-07-06 22:44 ` [PATCH v2 00/37] tests/tcg: run tests with meson Pierrick Bouvier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.