]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: tests: built utils static libraries
authorPavel Hrdina <phrdina@redhat.com>
Thu, 18 Jun 2020 00:01:49 +0000 (02:01 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 3 Aug 2020 07:27:05 +0000 (09:27 +0200)
With the old build system we just list the source files directly for
each test, but this would not work as expected with Meson.

For every binary there is a separate directory with its object files
which would mean all the utils sources would be compiled repeatedly
for every test using them.

Having static libraries ensures that the utils sources are compiled
only once.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
tests/Makefile.am
tests/meson.build
tests/testutils.c

index 011cda7b31632fcd4f97733b453bf5a5537e2336..a8fea66f1dc685561c91064a3c35788cd19b58be 100644 (file)
@@ -137,7 +137,7 @@ test_programs += qemuxml2argvtest qemuxml2xmltest \
        qemuvhostusertest \
        $(NULL)
 test_helpers += qemucapsprobe
-test_libraries += libqemumonitortestutils.la \
+test_libraries += \
                libqemutestdriver.la \
                $(NULL)
 endif WITH_QEMU
@@ -352,16 +352,8 @@ libxlxml2domconfigtest_LDADD = libxltestdriver.la \
        $(libxl_LDADDS) $(LIBXML_LIBS)
 endif WITH_LIBXL
 
-QEMUMONITORTESTUTILS_SOURCES = \
-       qemumonitortestutils.c \
-       qemumonitortestutils.h \
-       testutilsqemuschema.h testutilsqemuschema.c \
-       $(NULL)
-
 if WITH_QEMU
 
-libqemumonitortestutils_la_SOURCES = $(QEMUMONITORTESTUTILS_SOURCES)
-
 qemu_LDADDS = ../src/libvirt_driver_qemu_impl.la
 if WITH_DTRACE_PROBES
 qemu_LDADDS += ../src/libvirt_qemu_probes.lo
index ca6e5b5f74d21c8efee8bbd4aa9ef3dbdb0ce2f2..5cbd3cd20774cffc65157003a1bf392db78bdede 100644 (file)
@@ -117,3 +117,56 @@ foreach mock : mock_libs
     ],
   )
 endforeach
+
+
+# build libraries used by tests
+
+test_utils_lib = static_library(
+  'test_utils',
+  [ 'testutils.c' ],
+  dependencies: [ tests_dep ],
+)
+
+if conf.has('WITH_LIBXL')
+  test_utils_xen_lib = static_library(
+    'test_utils_xen',
+    [ 'testutilsxen.c' ],
+    dependencies: [ tests_dep ],
+  )
+
+else
+  test_utils_xen_lib = []
+endif
+
+if conf.has('WITH_LXC')
+  test_utils_lxc_lib = static_library(
+    'test_utils_lxc',
+    [ 'testutilslxc.c' ],
+    dependencies: [ tests_dep ],
+  )
+else
+  test_utils_lxc_lib = []
+endif
+
+if conf.has('WITH_QEMU')
+  test_utils_qemu_lib = static_library(
+    'test_utils_qemu',
+    [ 'testutilsqemu.c' ],
+    dependencies: [ tests_dep ],
+  )
+
+  test_utils_qemu_monitor_lib = static_library(
+    'test_utils_qemu_monitor',
+    [ 'qemumonitortestutils.c', 'testutilsqemuschema.c' ],
+    dependencies: [ tests_dep ],
+  )
+else
+  test_utils_qemu_lib = []
+  test_utils_qemu_monitor_lib = []
+endif
+
+test_file_wrapper_lib = static_library(
+  'test_file_wrapper',
+  [ 'virfilewrapper.c' ],
+  dependencies: [ tests_dep ],
+)
index a1cd093e4e20264475269dd71decfff5d52ffc0f..3f53f635fc29f93796be2c833856d505b2789dd4 100644 (file)
@@ -340,7 +340,7 @@ virTestRewrapFile(const char *filename)
 
     script = g_strdup_printf("%s/scripts/test-wrap-argv.py", abs_top_srcdir);
 
-    cmd = virCommandNewArgList(PYTHON, script, "--in-place", filename, NULL);
+    cmd = virCommandNewArgList(PYTHON3, script, "--in-place", filename, NULL);
     if (virCommandRun(cmd, NULL) < 0)
         return -1;