Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
tests/Makefile.am | 12 ------------
tests/meson.build | 45 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 12 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 856ae8dad15..45740b3e08a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -16,18 +16,6 @@
## License along with this library. If not, see
## <
http://www.gnu.org/licenses/>.
-PROBES_O =
-if WITH_DTRACE_PROBES
-PROBES_O += ../src/libvirt_probes.lo
-endif WITH_DTRACE_PROBES
-
-LDADDS = \
- $(NO_INDIRECT_LDFLAGS) \
- $(PROBES_O) \
- ../src/libvirt.la \
- $(GLIB_LIBS) \
- $(NULL)
-
test_programs = virshtest sockettest \
virhostcputest virbuftest \
commandtest seclabeltest \
diff --git a/tests/meson.build b/tests/meson.build
index cdcb87453fc..1fb332e7973 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -228,3 +228,48 @@ executable(
coverage_flags,
],
)
+
+
+# build and define libvirt tests
+
+# tests:
+# 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 [])
+# * deps - additional dependencies (optional, default [])
+# * include - include_directories (optional, default [])
+# * link_with - compiled libraries to link with (optional, default [])
+
+tests = []
+
+foreach data : tests
+ test_sources = '@0@.c'.format(data['name'])
+ test_bin = executable(
+ data['name'],
+ [
+ data.get('sources', test_sources),
+ dtrace_gen_objects,
+ ],
+ c_args: [
+ data.get('c_args', []),
+ ],
+ dependencies: [
+ tests_dep,
+ data.get('deps', []),
+ ],
+ include_directories: [
+ data.get('include', []),
+ ],
+ link_args: [
+ libvirt_no_indirect,
+ ],
+ link_with: [
+ libvirt_lib,
+ test_utils_lib,
+ data.get('link_with', []),
+ ],
+ export_dynamic: true,
+ )
+ test(data['name'], test_bin, env: tests_env)
+endforeach
--
2.26.2