]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: tests: add helper binaries build support
authorPavel Hrdina <phrdina@redhat.com>
Tue, 2 Jun 2020 17:15:22 +0000 (19:15 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 3 Aug 2020 07:27:06 +0000 (09:27 +0200)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
tests/meson.build

index edb07e339faaab69ea2436e5f520a5f02a62f035..d1f35d9a48b24727bc14b91ced36709a6e6c853d 100644 (file)
@@ -579,3 +579,37 @@ foreach data : tests
   )
   test(data['name'], test_bin, env: tests_env)
 endforeach
+
+
+# helpers:
+#   each entry is a dictionary with following items:
+#   * name - name of the test which is also used as default source file name (required)
+#   * sources - override default sources based on name (optional, default [ '$name.c' ])
+#   * c_args - args used by test (optional, default [])
+#   * include - include_directories (optional, default [])
+#   * link_with - compiled libraries to link with (optional, default [])
+
+helpers = []
+
+foreach data : helpers
+  helper_sources = '@0@.c'.format(data['name'])
+  helper_bin = executable(
+    data['name'],
+    [
+      data.get('sources', helper_sources),
+    ],
+    c_args: [
+      data.get('c_args', []),
+    ],
+    dependencies: [
+      tests_dep,
+    ],
+    include_directories: [
+      data.get('include', []),
+    ],
+    link_with: [
+      data['link_with'],
+    ],
+    export_dynamic: true,
+  )
+endforeach