On Tue, 07 Jul 2026 01:32, Pierrick Bouvier <[email protected]> 
wrote:
This can be used to declare dependencies for a given test executable.
Useful when generating headers (like x86_64 does).

Signed-off-by: Pierrick Bouvier <[email protected]>
---

Reviewed-by: Manos Pitsidianakis <[email protected]>

tests/tcg/meson.build | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index 57e7c3f8801..1f553a0aa8d 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -41,6 +41,7 @@ tcg_tests = {}
#           'exe_name': ['provide an alternative binary name'],
#           'test_name': ['provide an alternative test name'],
#           'cflags': ['additional cflags to compile test', ...],
+#           'depends': [meson_dependency, ...],
#           'cc_feat': 'feature name, must be present in cc_feat_cflags',
#           'qemu_args': ['qemu command line flags', ...],
#           'expected_output': 'file_to_compare_output',
@@ -164,7 +165,7 @@ 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_feat', 'gdb_test', 'plugin_test', 'qemu_args',
+                   'depends', '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 +
@@ -262,6 +263,11 @@ foreach target, plan: tcg_tests
        built_tests += {exe_name: exe_name}
      endif

+      exe_depends = build_test_depends
+      if 'depends' in setup
+        exe_depends += setup['depends']
+      endif
+
      # build executable if needed
      if exe_name not in built_tests
        exe = custom_target(exe_name,
@@ -274,13 +280,13 @@ foreach target, plan: tcg_tests
                                      cflags],
                            depfile: exe_name + '.d',
                            output: exe_name + '.test',
-                            depends: build_test_depends,
+                            depends: exe_depends,
                            depend_files: build_test_depend_files,
                            build_by_default: false)
        built_tests += {exe_name: exe}
      endif

-      depends = []
+      test_depends = []
      qemu_args = []
      if 'qemu_args' in setup
        qemu_args = setup['qemu_args']
@@ -297,7 +303,7 @@ foreach target, plan: tcg_tests
        plugin_args = ','.join(plugin_args)

        # since we turn plugin into a string, add dependency explicitly
-        depends += plugin
+        test_depends += plugin
        qemu_args = ['-plugin', plugin.full_path() + plugin_args, qemu_args]
      endif

@@ -352,7 +358,7 @@ foreach target, plan: tcg_tests
      endif

      test(test_name, env, args: cmd,
-           depends: depends,
+           depends: test_depends,
           suite: ['tcg', 'tcg-' + target])
      added_tests += {test_name: true}
    endforeach
--
2.47.3


Reply via email to