2020-05-21 14:41:32 +00:00
|
|
|
tests_dep = declare_dependency(
|
|
|
|
compile_args: [
|
|
|
|
'-Dabs_builddir="@0@"'.format(meson.current_build_dir()),
|
2022-10-07 07:31:32 +00:00
|
|
|
'-Dabs_top_builddir="@0@"'.format(meson.project_build_root()),
|
2020-05-21 14:41:32 +00:00
|
|
|
'-Dabs_srcdir="@0@"'.format(meson.current_source_dir()),
|
2022-10-07 07:37:43 +00:00
|
|
|
'-Dabs_top_srcdir="@0@"'.format(meson.project_source_root()),
|
2020-05-21 14:41:32 +00:00
|
|
|
] + coverage_flags + cc_flags_relaxed_frame_limit,
|
|
|
|
dependencies: [
|
|
|
|
apparmor_dep,
|
|
|
|
dlopen_dep,
|
|
|
|
glib_dep,
|
|
|
|
gnutls_dep,
|
2024-08-14 19:44:58 +00:00
|
|
|
json_c_dep,
|
2020-05-21 14:41:32 +00:00
|
|
|
libnl_dep,
|
|
|
|
libxml_dep,
|
|
|
|
rpc_dep,
|
|
|
|
sasl_dep,
|
|
|
|
selinux_dep,
|
|
|
|
xdr_dep,
|
|
|
|
],
|
|
|
|
include_directories: [
|
|
|
|
conf_inc_dir,
|
|
|
|
hypervisor_inc_dir,
|
|
|
|
libvirt_inc,
|
|
|
|
src_inc_dir,
|
|
|
|
top_inc_dir,
|
|
|
|
util_inc_dir,
|
|
|
|
],
|
2021-01-15 21:35:09 +00:00
|
|
|
link_args: (
|
|
|
|
libvirt_export_dynamic
|
2023-11-03 17:07:19 +00:00
|
|
|
+ libvirt_no_warn_duplicate_libraries
|
2022-08-08 18:14:08 +00:00
|
|
|
+ libvirt_flat_namespace
|
2021-01-15 21:35:09 +00:00
|
|
|
+ coverage_flags
|
|
|
|
),
|
2020-05-21 14:41:32 +00:00
|
|
|
)
|
2020-07-27 09:12:56 +00:00
|
|
|
|
2020-07-10 09:14:56 +00:00
|
|
|
tests_env = [
|
|
|
|
'abs_builddir=@0@'.format(meson.current_build_dir()),
|
|
|
|
'abs_srcdir=@0@'.format(meson.current_source_dir()),
|
2022-10-07 07:31:32 +00:00
|
|
|
'abs_top_builddir=@0@'.format(meson.project_build_root()),
|
2022-10-07 07:37:43 +00:00
|
|
|
'abs_top_srcdir=@0@'.format(meson.project_source_root()),
|
2020-07-10 09:14:56 +00:00
|
|
|
'LC_ALL=C',
|
|
|
|
'LIBVIRT_AUTOSTART=0',
|
|
|
|
]
|
|
|
|
|
2022-04-28 10:37:59 +00:00
|
|
|
|
|
|
|
# On macOS when BROKEN_POLL is set for GLib, our tests will
|
|
|
|
# periodically trigger a warning:
|
|
|
|
#
|
|
|
|
# (process:50880): GLib-WARNING **: 02:54:15.272: poll(2) failed due to: Bad file descriptor.
|
|
|
|
#
|
2022-05-16 11:02:06 +00:00
|
|
|
# Our code is inherently racy, calling g_source_destroy which
|
2022-04-28 10:37:59 +00:00
|
|
|
# removes the FD from the event thread poll asynchronously
|
|
|
|
# but we close the FD immediately after g_source_destroy returns.
|
|
|
|
#
|
|
|
|
# With poll() this results in POLLNVAL, but with select() it
|
|
|
|
# generates the BADF error on macOS
|
|
|
|
if host_machine.system() != 'darwin'
|
|
|
|
tests_env += ['G_DEBUG=fatal-warnings']
|
|
|
|
endif
|
|
|
|
|
2020-07-10 09:14:56 +00:00
|
|
|
if use_expensive_tests
|
|
|
|
tests_env += 'VIR_TEST_EXPENSIVE=1'
|
|
|
|
else
|
|
|
|
tests_env += 'VIR_TEST_EXPENSIVE=0'
|
|
|
|
endif
|
|
|
|
|
2020-07-27 09:12:56 +00:00
|
|
|
|
|
|
|
# mock_libs:
|
|
|
|
# each entry is a dictionary with following items:
|
|
|
|
# * name - mock library name which is also used as default source file name (required)
|
|
|
|
# * sources - override default sources based on name (optional, default [])
|
|
|
|
# * deps - additional dependencies (optional, default [])
|
|
|
|
|
|
|
|
mock_libs = [
|
|
|
|
{ 'name': 'vircgroupmock' },
|
2022-01-10 15:19:31 +00:00
|
|
|
{ 'name': 'virdnsmasqmock' },
|
2020-07-27 09:12:56 +00:00
|
|
|
{ 'name': 'virfilecachemock' },
|
2021-04-14 21:52:14 +00:00
|
|
|
{ 'name': 'virfirewallmock' },
|
2020-07-27 09:12:56 +00:00
|
|
|
{ 'name': 'virhostcpumock' },
|
|
|
|
{ 'name': 'virhostdevmock' },
|
|
|
|
{ 'name': 'virnetdaemonmock' },
|
|
|
|
{ 'name': 'virnetdevmock' },
|
|
|
|
{ 'name': 'virnetserverclientmock' },
|
2023-03-07 14:36:35 +00:00
|
|
|
{ 'name': 'virnumamock' },
|
2020-07-27 09:12:56 +00:00
|
|
|
{ 'name': 'virpcimock' },
|
|
|
|
{ 'name': 'virportallocatormock' },
|
|
|
|
{ 'name': 'virprocessmock' },
|
|
|
|
{ 'name': 'virrandommock' },
|
|
|
|
]
|
|
|
|
|
|
|
|
if host_machine.system() == 'linux'
|
|
|
|
mock_libs += [
|
|
|
|
{ 'name': 'virfilemock' },
|
|
|
|
{ 'name': 'virnetdevbandwidthmock' },
|
|
|
|
{ 'name': 'virtestmock' },
|
|
|
|
{ 'name': 'virusbmock' },
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2023-03-30 14:07:33 +00:00
|
|
|
if host_machine.system() != 'windows'
|
|
|
|
mock_libs += [
|
2023-03-30 14:08:05 +00:00
|
|
|
{ 'name': 'virgdbusmock' },
|
2023-03-30 14:07:33 +00:00
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2024-05-07 09:40:15 +00:00
|
|
|
if conf.has('WITH_TEST')
|
|
|
|
mock_libs += [
|
|
|
|
{ 'name': 'shunload', 'sources': [ 'shunloadhelper.c' ] },
|
|
|
|
]
|
|
|
|
endif
|
2020-06-18 00:01:49 +00:00
|
|
|
|
|
|
|
# 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 ],
|
|
|
|
)
|
|
|
|
|
2020-07-27 09:16:34 +00:00
|
|
|
test_xen_driver_lib = shared_library(
|
|
|
|
'test_xen_driver',
|
|
|
|
link_whole: [ libxl_driver_imp ],
|
|
|
|
link_with: [ libvirt_lib ],
|
|
|
|
)
|
2022-04-14 10:44:31 +00:00
|
|
|
|
|
|
|
mock_libs += [
|
|
|
|
{ 'name': 'xlmock', 'sources': [ 'libxlmock.c' ], 'deps': [ libxl_dep ] },
|
|
|
|
]
|
2020-06-18 00:01:49 +00:00
|
|
|
else
|
|
|
|
test_utils_xen_lib = []
|
2020-07-27 09:16:34 +00:00
|
|
|
test_xen_driver_lib = []
|
2020-06-18 00:01:49 +00:00
|
|
|
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',
|
2023-03-09 14:15:40 +00:00
|
|
|
[ 'testutilsqemu.c', 'testutilsqemuschema.c' ],
|
2020-06-18 00:01:49 +00:00
|
|
|
dependencies: [ tests_dep ],
|
|
|
|
)
|
|
|
|
|
|
|
|
test_utils_qemu_monitor_lib = static_library(
|
|
|
|
'test_utils_qemu_monitor',
|
2023-03-09 14:15:40 +00:00
|
|
|
[ 'qemumonitortestutils.c', ],
|
2020-06-18 00:01:49 +00:00
|
|
|
dependencies: [ tests_dep ],
|
|
|
|
)
|
2020-07-27 09:16:34 +00:00
|
|
|
|
|
|
|
test_qemu_driver_lib = shared_library(
|
|
|
|
'test_qemu_driver',
|
|
|
|
[ qemu_dtrace_gen_objects ],
|
2020-10-18 15:30:58 +00:00
|
|
|
link_args: [ libvirt_flat_namespace ],
|
2020-07-27 09:16:34 +00:00
|
|
|
link_whole: [ qemu_driver_impl ],
|
|
|
|
link_with: [ libvirt_lib ],
|
|
|
|
)
|
2020-11-23 22:10:18 +00:00
|
|
|
|
|
|
|
mock_libs += [
|
2022-04-14 10:44:31 +00:00
|
|
|
{ 'name': 'qemucaps2xmlmock' },
|
2020-11-23 22:10:18 +00:00
|
|
|
{ 'name': 'qemucapsprobemock', 'link_with': [ test_qemu_driver_lib ] },
|
2022-04-14 10:44:31 +00:00
|
|
|
{ 'name': 'qemucpumock' },
|
2024-05-13 10:34:09 +00:00
|
|
|
{ 'name': 'qemuhotplugmock', 'link_with': [ test_qemu_driver_lib, test_utils_qemu_lib, test_utils_lib ] },
|
2022-04-14 10:44:31 +00:00
|
|
|
{ 'name': 'qemuxml2argvmock' },
|
|
|
|
{ 'name': 'virhostidmock' },
|
2020-11-23 22:10:18 +00:00
|
|
|
]
|
2020-06-18 00:01:49 +00:00
|
|
|
else
|
2020-07-27 09:16:34 +00:00
|
|
|
test_qemu_driver_lib = []
|
2020-06-18 00:01:49 +00:00
|
|
|
test_utils_qemu_lib = []
|
|
|
|
test_utils_qemu_monitor_lib = []
|
|
|
|
endif
|
|
|
|
|
2024-05-13 10:34:09 +00:00
|
|
|
mock_libs += [
|
|
|
|
# domaincapsmock has some code guarded with WITH_QEMU
|
|
|
|
{ 'name': 'domaincapsmock', 'link_with': [ test_qemu_driver_lib ] },
|
|
|
|
]
|
|
|
|
|
2020-06-18 00:01:49 +00:00
|
|
|
test_file_wrapper_lib = static_library(
|
|
|
|
'test_file_wrapper',
|
|
|
|
[ 'virfilewrapper.c' ],
|
|
|
|
dependencies: [ tests_dep ],
|
|
|
|
)
|
2020-06-18 00:02:30 +00:00
|
|
|
|
2022-03-24 09:36:56 +00:00
|
|
|
tests_deps = []
|
2020-06-18 00:02:30 +00:00
|
|
|
|
|
|
|
# build helpers used by tests
|
|
|
|
|
|
|
|
# Must not link to any libvirt modules - libc only otherwise external
|
|
|
|
# libraries might unexpectedly leak file descriptors into commandhelper
|
|
|
|
# invalidating the test logic assumptions.
|
2022-03-24 09:36:56 +00:00
|
|
|
tests_deps += executable(
|
2020-06-18 00:02:30 +00:00
|
|
|
'commandhelper',
|
|
|
|
[ 'commandhelper.c' ],
|
|
|
|
dependencies: [
|
|
|
|
tests_dep,
|
|
|
|
],
|
|
|
|
link_args: [
|
|
|
|
libvirt_no_indirect,
|
|
|
|
],
|
|
|
|
)
|
2020-06-18 00:02:58 +00:00
|
|
|
|
|
|
|
# This is a fake SSH we use from virnetsockettest
|
2022-03-24 09:36:56 +00:00
|
|
|
tests_deps += executable(
|
2020-06-18 00:02:58 +00:00
|
|
|
'ssh',
|
|
|
|
[ 'ssh.c' ],
|
|
|
|
dependencies: [
|
|
|
|
tests_dep,
|
|
|
|
],
|
|
|
|
)
|
2020-06-25 11:05:51 +00:00
|
|
|
|
2020-10-08 10:01:29 +00:00
|
|
|
subdir('schemas')
|
2020-06-25 11:05:51 +00:00
|
|
|
|
|
|
|
# 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 [])
|
|
|
|
# * link_whole - compiled libraries to link whole (optional, default [])
|
|
|
|
|
|
|
|
tests = []
|
|
|
|
|
2020-07-23 22:49:01 +00:00
|
|
|
cputest_link_with = []
|
|
|
|
cputest_link_whole = []
|
|
|
|
if conf.has('WITH_QEMU')
|
|
|
|
cputest_link_with += [ test_utils_qemu_monitor_lib, test_qemu_driver_lib ]
|
|
|
|
cputest_link_whole += [ test_utils_qemu_lib ]
|
|
|
|
endif
|
|
|
|
|
|
|
|
domaincapstest_link_with = []
|
|
|
|
domaincapstest_link_whole = [ test_file_wrapper_lib ]
|
|
|
|
if conf.has('WITH_BHYVE')
|
|
|
|
domaincapstest_link_with += [ bhyve_driver_impl ]
|
|
|
|
endif
|
|
|
|
if conf.has('WITH_LIBXL')
|
|
|
|
domaincapstest_link_with += [ test_xen_driver_lib ]
|
|
|
|
domaincapstest_link_whole += [ test_utils_xen_lib ]
|
|
|
|
endif
|
|
|
|
if conf.has('WITH_QEMU')
|
|
|
|
domaincapstest_link_with += [ test_qemu_driver_lib ]
|
|
|
|
domaincapstest_link_whole += [ test_utils_qemu_lib ]
|
|
|
|
endif
|
|
|
|
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'commandtest' },
|
|
|
|
{ 'name': 'cputest', 'link_with': cputest_link_with, 'link_whole': cputest_link_whole },
|
|
|
|
{ 'name': 'domaincapstest', 'link_with': domaincapstest_link_with, 'link_whole': domaincapstest_link_whole },
|
|
|
|
{ 'name': 'domainconftest' },
|
|
|
|
{ 'name': 'genericxml2xmltest' },
|
|
|
|
{ 'name': 'interfacexml2xmltest' },
|
|
|
|
{ 'name': 'networkxml2xmlupdatetest' },
|
|
|
|
{ 'name': 'nodedevxml2xmltest' },
|
|
|
|
{ 'name': 'nwfilterxml2xmltest' },
|
|
|
|
{ 'name': 'seclabeltest' },
|
|
|
|
{ 'name': 'secretxml2xmltest' },
|
|
|
|
{ 'name': 'sockettest' },
|
|
|
|
{ 'name': 'storagevolxml2xmltest' },
|
|
|
|
{ 'name': 'sysinfotest' },
|
|
|
|
{ 'name': 'utiltest' },
|
|
|
|
{ 'name': 'viralloctest' },
|
|
|
|
{ 'name': 'virauthconfigtest' },
|
|
|
|
{ 'name': 'virbitmaptest' },
|
|
|
|
{ 'name': 'virbuftest' },
|
|
|
|
{ 'name': 'vircgrouptest' },
|
|
|
|
{ 'name': 'virconftest' },
|
|
|
|
{ 'name': 'vircryptotest' },
|
|
|
|
{ 'name': 'virendiantest' },
|
|
|
|
{ 'name': 'virerrortest' },
|
|
|
|
{ 'name': 'virfilecachetest' },
|
|
|
|
{ 'name': 'virfiletest' },
|
2020-09-15 12:00:53 +00:00
|
|
|
{ 'name': 'virfirewalltest' },
|
2020-07-23 22:49:01 +00:00
|
|
|
{ 'name': 'virhostcputest', 'link_whole': [ test_file_wrapper_lib ] },
|
|
|
|
{ 'name': 'virhostdevtest' },
|
2020-11-06 08:58:33 +00:00
|
|
|
{ 'name': 'viridentitytest' },
|
2020-07-23 22:49:01 +00:00
|
|
|
{ 'name': 'viriscsitest' },
|
|
|
|
{ 'name': 'virkeycodetest' },
|
|
|
|
{ 'name': 'virkmodtest' },
|
|
|
|
{ 'name': 'virlockspacetest' },
|
|
|
|
{ 'name': 'virlogtest' },
|
|
|
|
{ 'name': 'virnetdevtest' },
|
|
|
|
{ 'name': 'virnetworkportxml2xmltest' },
|
|
|
|
{ 'name': 'virnwfilterbindingxml2xmltest' },
|
|
|
|
{ 'name': 'virpcitest' },
|
|
|
|
{ 'name': 'virportallocatortest' },
|
|
|
|
{ 'name': 'virrotatingfiletest' },
|
|
|
|
{ 'name': 'virschematest' },
|
|
|
|
{ 'name': 'virstringtest' },
|
2020-09-09 14:42:42 +00:00
|
|
|
{ 'name': 'virsystemdtest' },
|
2020-07-23 22:49:01 +00:00
|
|
|
{ 'name': 'virtimetest' },
|
|
|
|
{ 'name': 'virtypedparamtest' },
|
|
|
|
{ 'name': 'viruritest' },
|
2021-10-20 08:30:31 +00:00
|
|
|
{ 'name': 'virpcivpdtest' },
|
2020-07-23 22:49:01 +00:00
|
|
|
{ 'name': 'vshtabletest', 'link_with': [ libvirt_shell_lib ] },
|
2018-09-20 11:33:45 +00:00
|
|
|
{ 'name': 'virmigtest' },
|
2020-07-23 22:49:01 +00:00
|
|
|
]
|
|
|
|
|
2023-04-18 09:53:08 +00:00
|
|
|
if host_machine.endian() == 'little'
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'viracpitest' },
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-07-27 09:34:03 +00:00
|
|
|
if host_machine.system() == 'linux'
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'fchosttest' },
|
|
|
|
{ 'name': 'scsihosttest' },
|
|
|
|
{ 'name': 'vircaps2xmltest', 'link_whole': [ test_file_wrapper_lib ] },
|
|
|
|
{ 'name': 'virnetdevbandwidthtest' },
|
2021-11-18 15:13:52 +00:00
|
|
|
{ 'name': 'virprocessstattest', 'link_whole': [ test_file_wrapper_lib ] },
|
2020-07-27 09:34:03 +00:00
|
|
|
{ 'name': 'virresctrltest', 'link_whole': [ test_file_wrapper_lib ] },
|
|
|
|
{ 'name': 'virscsitest' },
|
|
|
|
{ 'name': 'virusbtest' },
|
|
|
|
]
|
2024-09-04 14:02:16 +00:00
|
|
|
if conf.has('WITH_JSON')
|
2021-08-20 12:56:53 +00:00
|
|
|
tests += [
|
|
|
|
{ 'name': 'virnetdevopenvswitchtest' },
|
|
|
|
]
|
|
|
|
endif
|
2020-07-27 09:34:03 +00:00
|
|
|
endif
|
|
|
|
|
2024-05-07 09:40:15 +00:00
|
|
|
if conf.has('WITH_TEST')
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'fdstreamtest' },
|
|
|
|
{ 'name': 'metadatatest' },
|
|
|
|
{ 'name': 'networkmetadatatest' },
|
|
|
|
{ 'name': 'objecteventtest' },
|
|
|
|
{ 'name': 'shunloadtest', 'deps': [ thread_dep ] },
|
|
|
|
{ 'name': 'virshtest', 'depends': [ virsh_prog ] },
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-07-27 09:34:24 +00:00
|
|
|
if conf.has('WITH_BHYVE')
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'bhyveargv2xmltest', 'link_with': [ bhyve_driver_impl ] },
|
|
|
|
{ 'name': 'bhyvexml2argvtest', 'link_with': [ bhyve_driver_impl ] },
|
|
|
|
{ 'name': 'bhyvexml2xmltest', 'link_with': [ bhyve_driver_impl ] },
|
|
|
|
]
|
2022-04-14 10:44:31 +00:00
|
|
|
|
|
|
|
mock_libs += [
|
|
|
|
{ 'name': 'bhyveargv2xmlmock' },
|
|
|
|
{ 'name': 'bhyvexml2argvmock' },
|
|
|
|
]
|
2020-07-27 09:34:24 +00:00
|
|
|
endif
|
|
|
|
|
2023-02-10 11:40:04 +00:00
|
|
|
if conf.has('WITH_CH')
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'chxml2xmltest', 'link_with': [ ch_driver_impl ] },
|
|
|
|
]
|
2024-03-08 14:03:04 +00:00
|
|
|
mock_libs += [
|
|
|
|
{ 'name': 'chxml2xmlmock' },
|
|
|
|
]
|
2023-02-10 11:40:04 +00:00
|
|
|
endif
|
|
|
|
|
2020-07-27 09:36:22 +00:00
|
|
|
if conf.has('WITH_ESX')
|
|
|
|
tests += [
|
2020-09-23 08:29:56 +00:00
|
|
|
{ 'name': 'esxutilstest', 'deps': [ esx_dep ] },
|
2020-07-27 09:36:22 +00:00
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-07-27 09:36:37 +00:00
|
|
|
if conf.has('WITH_LIBVIRTD')
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'eventtest', 'deps': [ thread_dep ] },
|
|
|
|
{ 'name': 'virdriverconnvalidatetest' },
|
2024-05-07 12:23:39 +00:00
|
|
|
{ 'name': 'virdrivermoduletest', 'depends': virt_module_deps },
|
2020-07-27 09:36:37 +00:00
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-07-27 09:36:53 +00:00
|
|
|
if conf.has('WITH_LIBXL')
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'libxlxml2domconfigtest', 'link_with': [ test_xen_driver_lib ], 'link_whole': [ test_utils_xen_lib ], 'deps': [ libxl_dep ] },
|
|
|
|
{ 'name': 'xlconfigtest', 'link_with': [ test_xen_driver_lib ], 'link_whole': [ test_utils_xen_lib ] },
|
|
|
|
{ 'name': 'xmconfigtest', 'link_with': [ test_xen_driver_lib ], 'link_whole': [ test_utils_xen_lib ] },
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-07-27 09:37:21 +00:00
|
|
|
if conf.has('WITH_LXC')
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'lxcconf2xmltest', 'link_with': [ lxc_driver_impl_lib ], 'link_whole': [ test_utils_lxc_lib ] },
|
|
|
|
{ 'name': 'lxcxml2xmltest', 'link_with': [ lxc_driver_impl_lib ], 'link_whole': [ test_utils_lxc_lib ] },
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-07-27 09:37:34 +00:00
|
|
|
if conf.has('WITH_NETWORK')
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'networkxml2conftest', 'link_with': [ network_driver_impl ] },
|
2020-09-15 12:00:53 +00:00
|
|
|
{ 'name': 'networkxml2firewalltest', 'link_with': [ network_driver_impl ] },
|
2020-07-27 09:37:34 +00:00
|
|
|
{ 'name': 'networkxml2xmltest', 'link_with': [ network_driver_impl ] },
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2024-09-04 14:02:16 +00:00
|
|
|
if conf.has('WITH_NODE_DEVICES') and conf.has('WITH_JSON')
|
2020-06-24 10:28:17 +00:00
|
|
|
tests += [
|
|
|
|
{ 'name': 'nodedevmdevctltest', 'link_with': [ node_device_driver_impl ] },
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-06-24 10:28:57 +00:00
|
|
|
if conf.has('WITH_NSS')
|
|
|
|
tests += [
|
|
|
|
{
|
|
|
|
'name': 'nsstest',
|
|
|
|
'include': [ nss_inc_dir ],
|
|
|
|
'link_with': [ nss_libvirt_impl ],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'name': 'nssguesttest',
|
|
|
|
'sources': [ 'nsstest.c' ],
|
|
|
|
'c_args': [ '-DLIBVIRT_NSS_GUEST' ],
|
|
|
|
'include': [ nss_inc_dir ],
|
|
|
|
'link_with': [ nss_libvirt_guest_impl ],
|
|
|
|
},
|
|
|
|
]
|
2022-04-14 10:44:31 +00:00
|
|
|
|
|
|
|
mock_libs += [
|
|
|
|
{ 'name': 'nssmock' },
|
|
|
|
]
|
2020-06-24 10:28:57 +00:00
|
|
|
endif
|
|
|
|
|
2020-06-02 16:42:07 +00:00
|
|
|
if conf.has('WITH_NWFILTER')
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'nwfilterebiptablestest', 'link_with': [ nwfilter_driver_impl ] },
|
|
|
|
{ 'name': 'nwfilterxml2firewalltest', 'link_with': [ nwfilter_driver_impl ] },
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-07-27 09:37:51 +00:00
|
|
|
if conf.has('WITH_OPENVZ')
|
|
|
|
tests += [
|
2021-05-06 15:08:36 +00:00
|
|
|
{ 'name': 'openvzutilstest' },
|
2020-07-27 09:37:51 +00:00
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-09-09 14:42:16 +00:00
|
|
|
if conf.has('WITH_POLKIT')
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'virpolkittest' },
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-07-27 09:38:19 +00:00
|
|
|
if conf.has('WITH_QEMU')
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'qemuagenttest', 'link_with': [ test_qemu_driver_lib, test_utils_qemu_monitor_lib ], 'link_whole': [ test_utils_qemu_lib ] },
|
2021-01-22 09:36:21 +00:00
|
|
|
{ 'name': 'qemublocktest', 'include': [ storage_file_inc_dir ], 'link_with': [ test_qemu_driver_lib, test_utils_qemu_monitor_lib ], 'link_whole': [ test_utils_qemu_lib ] },
|
2020-07-27 09:38:19 +00:00
|
|
|
{ 'name': 'qemucapabilitiestest', 'link_with': [ test_qemu_driver_lib, test_utils_qemu_monitor_lib ], 'link_whole': [ test_utils_qemu_lib ] },
|
|
|
|
{ 'name': 'qemucaps2xmltest', 'link_with': [ test_qemu_driver_lib ], 'link_whole': [ test_utils_qemu_lib ] },
|
|
|
|
{ 'name': 'qemucommandutiltest', 'link_with': [ test_qemu_driver_lib, test_utils_qemu_monitor_lib ], 'link_whole': [ test_utils_qemu_lib ] },
|
|
|
|
{ 'name': 'qemudomaincheckpointxml2xmltest', 'link_with': [ test_qemu_driver_lib ], 'link_whole': [ test_utils_qemu_lib ] },
|
|
|
|
{ 'name': 'qemudomainsnapshotxml2xmltest', 'link_with': [ test_qemu_driver_lib ], 'link_whole': [ test_utils_qemu_lib ] },
|
|
|
|
{ 'name': 'qemufirmwaretest', 'link_with': [ test_qemu_driver_lib ], 'link_whole': [ test_file_wrapper_lib ] },
|
|
|
|
{ 'name': 'qemuhotplugtest', 'link_with': [ test_qemu_driver_lib, test_utils_qemu_monitor_lib ], 'link_whole': [ test_utils_qemu_lib ] },
|
|
|
|
{ 'name': 'qemumemlocktest', 'link_with': [ test_qemu_driver_lib ], 'link_whole': [ test_utils_qemu_lib ] },
|
|
|
|
{ 'name': 'qemumigparamstest', 'link_with': [ test_qemu_driver_lib, test_utils_qemu_monitor_lib ], 'link_whole': [ test_utils_qemu_lib ] },
|
2021-02-10 19:37:28 +00:00
|
|
|
{ 'name': 'qemumigrationcookiexmltest', 'link_with': [ test_qemu_driver_lib, test_utils_qemu_monitor_lib ], 'link_whole': [ test_utils_qemu_lib, test_file_wrapper_lib ] },
|
2020-07-27 09:38:19 +00:00
|
|
|
{ 'name': 'qemumonitorjsontest', 'link_with': [ test_qemu_driver_lib, test_utils_qemu_monitor_lib ], 'link_whole': [ test_utils_qemu_lib ] },
|
|
|
|
{ 'name': 'qemusecuritytest', 'sources': [ 'qemusecuritytest.c', 'qemusecuritymock.c' ], 'link_with': [ test_qemu_driver_lib ], 'link_whole': [ test_utils_qemu_lib ] },
|
2023-12-15 12:39:49 +00:00
|
|
|
{ 'name': 'qemuxmlactivetest', 'link_with': [ test_qemu_driver_lib ], 'link_whole': [ test_utils_qemu_lib, test_file_wrapper_lib ] },
|
2020-07-27 09:38:19 +00:00
|
|
|
{ 'name': 'qemuvhostusertest', 'link_with': [ test_qemu_driver_lib ], 'link_whole': [ test_file_wrapper_lib ] },
|
2023-12-18 15:21:40 +00:00
|
|
|
{ 'name': 'qemuxmlconftest', 'timeout': 90, 'link_with': [ test_qemu_driver_lib, test_utils_qemu_monitor_lib ], 'link_whole': [ test_utils_qemu_lib, test_file_wrapper_lib ] },
|
2020-07-27 09:38:19 +00:00
|
|
|
]
|
2022-10-05 17:03:33 +00:00
|
|
|
if conf.has('WITH_NBDKIT')
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'qemunbdkittest', 'link_with': [ test_qemu_driver_lib ], 'link_whole': [ test_utils_qemu_lib, test_file_wrapper_lib ] },
|
|
|
|
]
|
|
|
|
endif
|
2020-07-27 09:38:19 +00:00
|
|
|
endif
|
|
|
|
|
2020-07-27 09:38:46 +00:00
|
|
|
if conf.has('WITH_REMOTE')
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'virnetdaemontest' },
|
|
|
|
{ 'name': 'virnetmessagetest' },
|
|
|
|
{ 'name': 'virnetserverclienttest' },
|
|
|
|
{ 'name': 'virnetsockettest' },
|
|
|
|
]
|
|
|
|
|
|
|
|
nettls_sources = [ 'virnettlshelpers.c' ]
|
2020-09-01 11:27:44 +00:00
|
|
|
if conf.has('WITH_LIBTASN1_H')
|
2020-07-27 09:38:46 +00:00
|
|
|
nettls_sources += 'pkix_asn1_tab.c'
|
|
|
|
endif
|
|
|
|
|
|
|
|
libtasn1_dep = cc.find_library('tasn1', required: false)
|
|
|
|
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'virnettlscontexttest', 'sources': [ 'virnettlscontexttest.c', nettls_sources ], 'deps': [ libtasn1_dep, ] },
|
|
|
|
{ 'name': 'virnettlssessiontest', 'sources': [ 'virnettlssessiontest.c', nettls_sources ], 'deps': [ libtasn1_dep, ] },
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-06-25 11:06:59 +00:00
|
|
|
if conf.has('WITH_SECDRIVER_SELINUX')
|
2020-09-23 13:12:59 +00:00
|
|
|
if conf.has('WITH_LIBATTR')
|
2020-06-25 11:06:59 +00:00
|
|
|
tests += [
|
|
|
|
{ 'name': 'securityselinuxtest' },
|
|
|
|
]
|
|
|
|
|
|
|
|
if conf.has('WITH_QEMU')
|
|
|
|
tests += [
|
2020-09-23 13:12:59 +00:00
|
|
|
{ 'name': 'securityselinuxlabeltest', 'link_with': [ test_qemu_driver_lib ], 'link_whole': [ test_utils_qemu_lib ] },
|
2020-06-25 11:06:59 +00:00
|
|
|
]
|
|
|
|
endif
|
|
|
|
endif
|
2024-05-07 13:17:36 +00:00
|
|
|
endif
|
2022-04-14 10:44:31 +00:00
|
|
|
|
2024-05-07 13:17:36 +00:00
|
|
|
if conf.has('WITH_SELINUX')
|
2022-04-14 10:44:31 +00:00
|
|
|
mock_libs += [
|
|
|
|
{ 'name': 'securityselinuxhelper' },
|
|
|
|
]
|
2020-06-25 11:06:59 +00:00
|
|
|
endif
|
|
|
|
|
2020-07-27 09:39:06 +00:00
|
|
|
if conf.has('WITH_STORAGE')
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'storagepoolcapstest' },
|
|
|
|
{ 'name': 'storagepoolxml2argvtest', 'link_with': [ storage_driver_impl_lib ] },
|
|
|
|
{ 'name': 'storagepoolxml2xmltest', 'link_with': [ storage_driver_impl_lib ] },
|
|
|
|
{ 'name': 'storagevolxml2argvtest', 'link_with': [ storage_driver_impl_lib ] },
|
|
|
|
{ 'name': 'virstorageutiltest', 'link_with': [ storage_driver_impl_lib ] },
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-06-02 17:02:11 +00:00
|
|
|
if conf.has('WITH_STORAGE_FS')
|
|
|
|
tests += [
|
2021-01-22 09:36:21 +00:00
|
|
|
{ 'name': 'virstoragetest', 'include': [ storage_file_inc_dir ],'link_with': [ storage_driver_impl_lib ] },
|
2020-06-02 17:02:11 +00:00
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-07-27 09:39:29 +00:00
|
|
|
if conf.has('WITH_VBOX')
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'vboxsnapshotxmltest', 'link_with': [ vbox_driver_impl ] },
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-07-27 09:39:41 +00:00
|
|
|
if conf.has('WITH_VMWARE')
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'vmwarevertest' },
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-07-27 09:39:54 +00:00
|
|
|
if conf.has('WITH_VMX')
|
|
|
|
tests += [
|
|
|
|
{ 'name': 'vmx2xmltest' },
|
|
|
|
{ 'name': 'xml2vmxtest' },
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2024-09-04 14:02:16 +00:00
|
|
|
if conf.has('WITH_JSON')
|
2020-07-27 09:41:16 +00:00
|
|
|
tests += [
|
|
|
|
{ 'name': 'virjsontest' },
|
|
|
|
{ 'name': 'virmacmaptest' },
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2022-04-14 10:44:31 +00:00
|
|
|
foreach mock : mock_libs
|
|
|
|
tests_deps += shared_library(
|
|
|
|
mock['name'],
|
|
|
|
mock.get('sources', [ '@0@.c'.format(mock['name']) ]),
|
|
|
|
override_options: [
|
|
|
|
'b_asneeded=false',
|
|
|
|
'b_lundef=false',
|
|
|
|
],
|
|
|
|
dependencies: [
|
|
|
|
tests_dep,
|
|
|
|
mock.get('deps', []),
|
|
|
|
],
|
|
|
|
link_with: [
|
|
|
|
libvirt_lib,
|
|
|
|
mock.get('link_with', []),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
endforeach
|
|
|
|
|
2020-06-25 11:05:51 +00:00
|
|
|
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,
|
|
|
|
data.get('link_with', []),
|
|
|
|
],
|
|
|
|
link_whole: [
|
|
|
|
test_utils_lib,
|
|
|
|
data.get('link_whole', []),
|
|
|
|
],
|
|
|
|
export_dynamic: true,
|
|
|
|
)
|
2023-07-15 05:52:43 +00:00
|
|
|
test(
|
|
|
|
data['name'],
|
|
|
|
test_bin,
|
|
|
|
env: tests_env,
|
2024-01-08 15:48:15 +00:00
|
|
|
timeout: data.get('timeout', 30),
|
2024-04-08 13:55:38 +00:00
|
|
|
depends: tests_deps + data.get('depends', []),
|
2023-07-15 05:52:43 +00:00
|
|
|
suite: 'bin'
|
|
|
|
)
|
2020-06-25 11:05:51 +00:00
|
|
|
endforeach
|
2020-06-02 17:15:22 +00:00
|
|
|
|
2023-05-18 14:12:09 +00:00
|
|
|
test(
|
|
|
|
'qemu replies check',
|
|
|
|
python3_prog,
|
|
|
|
args: [
|
|
|
|
qemu_replies_tool_prog.full_path(),
|
|
|
|
'--repliesdir',
|
|
|
|
meson.project_source_root() / 'tests' / 'qemucapabilitiesdata'
|
|
|
|
],
|
|
|
|
env: runutf8,
|
|
|
|
suite: 'script',
|
|
|
|
)
|
|
|
|
|
2024-05-07 09:40:15 +00:00
|
|
|
if conf.has('WITH_TEST')
|
|
|
|
# vsh based client self-test, which can be run directly from meson
|
|
|
|
test('virsh self-test',
|
|
|
|
virsh_prog,
|
|
|
|
args: [ '-q', '-c', 'test:///default', 'self-test' ],
|
|
|
|
suite: 'bin',
|
|
|
|
)
|
|
|
|
endif
|
2024-03-22 09:02:02 +00:00
|
|
|
|
|
|
|
if conf.has('WITH_REMOTE')
|
|
|
|
test('virt-admin self-test',
|
|
|
|
virt_admin_prog,
|
|
|
|
args: [ '-q', 'self-test' ],
|
|
|
|
suite: 'bin',
|
|
|
|
)
|
|
|
|
endif
|
2020-06-02 17:15:22 +00:00
|
|
|
|
|
|
|
# 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 = []
|
|
|
|
|
2020-07-27 09:41:52 +00:00
|
|
|
if conf.has('WITH_NSS')
|
|
|
|
helpers += [
|
2021-04-15 08:12:12 +00:00
|
|
|
# Intentionally not linking with anything else.
|
2020-07-27 09:41:52 +00:00
|
|
|
# See the test source for more detailed explanation.
|
|
|
|
{
|
|
|
|
'name': 'nsslinktest',
|
|
|
|
'include': [ nss_inc_dir ],
|
|
|
|
'link_with': [ nss_libvirt_impl ],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'name': 'nssguestlinktest',
|
|
|
|
'sources': [ 'nsslinktest.c' ],
|
|
|
|
'c_args': [ '-DLIBVIRT_NSS_GUEST' ],
|
|
|
|
'include': [ nss_inc_dir ],
|
|
|
|
'link_with': [ nss_libvirt_guest_impl ],
|
|
|
|
},
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
|
|
|
if conf.has('WITH_QEMU')
|
|
|
|
helpers += [
|
|
|
|
{
|
|
|
|
'name': 'qemucapsprobe',
|
|
|
|
'link_with': [ test_qemu_driver_lib, libvirt_lib ],
|
|
|
|
},
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-06-02 17:15:22 +00:00
|
|
|
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
|
2020-07-27 09:43:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
# test_scripts:
|
|
|
|
# list of test scripts to run
|
|
|
|
test_scripts = []
|
|
|
|
|
2024-05-07 13:05:12 +00:00
|
|
|
if conf.has('WITH_TEST')
|
|
|
|
test_scripts += [
|
|
|
|
{ 'name': 'virsh-auth', 'depends': [ virsh_prog ] }
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-07-27 09:43:11 +00:00
|
|
|
if conf.has('WITH_LIBVIRTD')
|
2024-03-22 09:32:52 +00:00
|
|
|
test('libvirtd fail with missing config',
|
|
|
|
libvirtd_prog,
|
|
|
|
args: [ '--config=no-such-conf', '--timeout=5' ],
|
|
|
|
should_fail: true,
|
|
|
|
suite: 'bin',
|
|
|
|
)
|
|
|
|
|
2020-07-27 09:43:11 +00:00
|
|
|
if conf.has('WITH_SECDRIVER_APPARMOR')
|
2024-05-07 12:16:26 +00:00
|
|
|
test_scripts += { 'name': 'virt-aa-helper-test' }
|
2020-07-27 09:43:11 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2024-05-07 12:16:26 +00:00
|
|
|
foreach data : test_scripts
|
|
|
|
script = find_program(data['name'])
|
|
|
|
test(data['name'],
|
|
|
|
script,
|
|
|
|
env: tests_env,
|
|
|
|
depends: [
|
|
|
|
data.get('depends', []),
|
|
|
|
],
|
|
|
|
suite: 'script')
|
2020-07-27 09:43:11 +00:00
|
|
|
endforeach
|
2020-07-28 12:29:32 +00:00
|
|
|
|
2021-05-03 07:06:34 +00:00
|
|
|
testenv = runutf8
|
|
|
|
testenv += 'VIR_TEST_FILE_ACCESS=1'
|
|
|
|
|
2020-07-28 12:29:32 +00:00
|
|
|
add_test_setup(
|
|
|
|
'access',
|
2021-05-03 07:06:34 +00:00
|
|
|
env: testenv,
|
2022-10-07 07:43:33 +00:00
|
|
|
exe_wrapper: [ python3_prog, check_file_access_prog.full_path() ],
|
2020-07-28 12:29:32 +00:00
|
|
|
)
|
2020-06-25 16:13:44 +00:00
|
|
|
|
|
|
|
add_test_setup(
|
|
|
|
'valgrind',
|
|
|
|
exe_wrapper: [
|
|
|
|
'valgrind', '--quiet', '--leak-check=full', '--trace-children=yes',
|
|
|
|
'--trace-children-skip="*/tools/virsh,*/tests/commandhelper,/usr/bin/*"',
|
|
|
|
'--suppressions=@0@'.format(meson.current_source_dir() / '.valgrind.supp'),
|
|
|
|
'--error-exitcode=1',
|
|
|
|
],
|
|
|
|
# default timeout in meson is 30s
|
|
|
|
timeout_multiplier: 4,
|
|
|
|
)
|