mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
meson: tests: built utils static libraries
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>
This commit is contained in:
parent
8885a3c135
commit
401aa32fdb
@ -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
|
||||
|
@ -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 ],
|
||||
)
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user