meson: tests: introduce generic tests

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:
Pavel Hrdina 2020-07-24 00:49:01 +02:00
parent d11bf90f90
commit a69e945d54
2 changed files with 89 additions and 329 deletions

View File

@ -16,42 +16,6 @@
## License along with this library. If not, see
## <http://www.gnu.org/licenses/>.
test_programs = virshtest sockettest \
virhostcputest virbuftest \
commandtest seclabeltest \
virhashtest virconftest \
utiltest shunloadtest \
virtimetest viruritest \
viralloctest \
virauthconfigtest \
virbitmaptest \
vircgrouptest \
vircryptotest \
virpcitest \
virendiantest \
virfiletest \
virfilecachetest \
virfirewalltest \
viriscsitest \
virkeycodetest \
virlockspacetest \
virlogtest \
virrotatingfiletest \
virschematest \
virstringtest \
virportallocatortest \
sysinfotest \
virkmodtest \
vircapstest \
domaincapstest \
domainconftest \
virhostdevtest \
virnetdevtest \
virtypedparamtest \
vshtabletest \
virerrortest \
$(NULL)
if WITH_REMOTE
test_programs += \
virnetmessagetest \
@ -146,11 +110,6 @@ if WITH_YAJL
test_programs += virjsontest
endif WITH_YAJL
test_programs += \
networkxml2xmlupdatetest \
virnetworkportxml2xmltest \
$(NULL)
if WITH_NETWORK
test_programs += \
networkxml2xmltest \
@ -163,9 +122,6 @@ if WITH_STORAGE_SHEEPDOG
test_programs += storagebackendsheepdogtest
endif WITH_STORAGE_SHEEPDOG
test_programs += nwfilterxml2xmltest
test_programs += virnwfilterbindingxml2xmltest
if WITH_NWFILTER
test_programs += nwfilterebiptablestest
test_programs += nwfilterxml2firewalltest
@ -192,24 +148,10 @@ test_helpers += nsslinktest nssguestlinktest
test_programs += nsstest nssguesttest
endif WITH_NSS
test_programs += storagevolxml2xmltest
test_programs += nodedevxml2xmltest
if WITH_NODE_DEVICES
test_programs += nodedevmdevctltest
endif WITH_NODE_DEVICES
test_programs += interfacexml2xmltest
test_programs += cputest
test_programs += metadatatest
test_programs += secretxml2xmltest
test_programs += genericxml2xmltest
if WITH_LINUX
test_programs += virusbtest \
virnetdevbandwidthtest \
@ -247,8 +189,6 @@ test_programs += \
virdriverconnvalidatetest
endif WITH_LIBVIRTD
test_programs += objecteventtest
if WITH_SECDRIVER_APPARMOR
if WITH_LIBVIRTD
test_scripts += virt-aa-helper-test
@ -277,11 +217,6 @@ VALGRIND = valgrind --quiet --leak-check=full --trace-children=yes \
valgrind:
$(MAKE) check VG="$(LIBTOOL) --mode=execute $(VALGRIND)"
sockettest_SOURCES = \
sockettest.c \
testutils.c testutils.h
sockettest_LDADD = $(LDADDS)
if WITH_LIBXL
libxl_LDADDS = \
../src/libvirt_driver_libxl_impl.la \
@ -524,16 +459,6 @@ bhyveargv2xmltest_SOURCES = \
bhyveargv2xmltest_LDADD = $(bhyve_LDADDS)
endif WITH_BHYVE
networkxml2xmlupdatetest_SOURCES = \
networkxml2xmlupdatetest.c \
testutils.c testutils.h
networkxml2xmlupdatetest_LDADD = $(LDADDS)
virnetworkportxml2xmltest_SOURCES = \
virnetworkportxml2xmltest.c \
testutils.c testutils.h
virnetworkportxml2xmltest_LDADD = $(LDADDS)
if WITH_NETWORK
networkxml2xmltest_SOURCES = \
networkxml2xmltest.c \
@ -561,16 +486,6 @@ storagebackendsheepdogtest_LDADD = \
$(LDADDS)
endif WITH_STORAGE_SHEEPDOG
nwfilterxml2xmltest_SOURCES = \
nwfilterxml2xmltest.c \
testutils.c testutils.h
nwfilterxml2xmltest_LDADD = $(LDADDS)
virnwfilterbindingxml2xmltest_SOURCES = \
virnwfilterbindingxml2xmltest.c \
testutils.c testutils.h
virnwfilterbindingxml2xmltest_LDADD = $(LDADDS)
if WITH_NWFILTER
nwfilterebiptablestest_SOURCES = \
nwfilterebiptablestest.c \
@ -584,17 +499,6 @@ nwfilterxml2firewalltest_LDADD = \
../src/libvirt_driver_nwfilter_impl.la $(LDADDS)
endif WITH_NWFILTER
secretxml2xmltest_SOURCES = \
secretxml2xmltest.c \
testutils.c testutils.h
secretxml2xmltest_LDADD = $(LDADDS)
genericxml2xmltest_SOURCES = \
genericxml2xmltest.c \
testutils.c testutils.h
genericxml2xmltest_LDADD = $(LDADDS)
if WITH_STORAGE
virstorageutiltest_SOURCES = \
virstorageutiltest.c \
@ -635,16 +539,6 @@ storagepoolcapstest_SOURCES = \
storagepoolcapstest_LDADD = $(LDADDS)
endif WITH_STORAGE
storagevolxml2xmltest_SOURCES = \
storagevolxml2xmltest.c \
testutils.c testutils.h
storagevolxml2xmltest_LDADD = $(LDADDS)
nodedevxml2xmltest_SOURCES = \
nodedevxml2xmltest.c \
testutils.c testutils.h
nodedevxml2xmltest_LDADD = $(LDADDS)
if WITH_NODE_DEVICES
nodedevmdevctltest_SOURCES = \
nodedevmdevctltest.c \
@ -655,100 +549,6 @@ nodedevmdevctltest_LDADD = \
$(LDADDS)
endif WITH_NODE_DEVICES
interfacexml2xmltest_SOURCES = \
interfacexml2xmltest.c \
testutils.c testutils.h
interfacexml2xmltest_LDADD = $(LDADDS)
cputest_SOURCES = \
cputest.c \
testutils.c testutils.h
cputest_LDADD = $(LIBXML_LIBS)
if WITH_QEMU
cputest_SOURCES += testutilsqemu.c testutilsqemu.h
cputest_LDADD += libqemumonitortestutils.la $(qemu_LDADDS)
else ! WITH_QEMU
cputest_LDADD += $(LDADDS)
endif ! WITH_QEMU
metadatatest_SOURCES = \
metadatatest.c \
testutils.c testutils.h
metadatatest_LDADD = $(LDADDS) $(LIBXML_LIBS)
virerrortest_SOURCES = \
virerrortest.c \
testutils.c testutils.h
virerrortest_LDADD = $(LDADDS)
vshtabletest_SOURCES = \
vshtabletest.c \
testutils.c testutils.h
vshtabletest_LDADD = \
$(LDADDS) \
../tools/libvirt_shell.la
virshtest_SOURCES = \
virshtest.c \
testutils.c testutils.h
virshtest_LDADD = $(LDADDS)
virconftest_SOURCES = \
virconftest.c testutils.h testutils.c
virconftest_LDADD = $(LDADDS)
virhostcputest_SOURCES = \
virhostcputest.c testutils.h testutils.c virfilewrapper.h virfilewrapper.c
virhostcputest_LDADD = $(LDADDS)
commandtest_SOURCES = \
commandtest.c testutils.h testutils.c
commandtest_LDADD = $(LDADDS)
virkmodtest_SOURCES = \
virkmodtest.c testutils.h testutils.c
virkmodtest_LDADD = $(LDADDS)
vircapstest_SOURCES = \
vircapstest.c testutils.h testutils.c
if WITH_LXC
vircapstest_SOURCES += testutilslxc.c testutilslxc.h
endif WITH_LXC
if WITH_QEMU
vircapstest_SOURCES += testutilsqemu.c testutilsqemu.h
endif WITH_QEMU
vircapstest_LDADD =
if WITH_QEMU
vircapstest_LDADD += ../src/libvirt_driver_qemu_impl.la
if WITH_DTRACE_PROBES
vircapstest_LDADD += ../src/libvirt_qemu_probes.lo
endif WITH_DTRACE_PROBES
endif WITH_QEMU
if WITH_LXC
vircapstest_LDADD += ../src/libvirt_driver_lxc_impl.la
endif WITH_LXC
vircapstest_LDADD += $(LDADDS)
domaincapstest_SOURCES = \
domaincapstest.c testutils.h testutils.c \
virfilewrapper.c virfilewrapper.h \
$(NULL)
domaincapstest_LDADD = $(LDADDS)
if WITH_QEMU
domaincapstest_SOURCES += testutilsqemu.c testutilsqemu.h
domaincapstest_LDADD += libqemutestdriver.la
endif WITH_QEMU
if WITH_LIBXL
domaincapstest_SOURCES += testutilsxen.c testutilsxen.h
domaincapstest_LDADD += libxltestdriver.la
endif WITH_LIBXL
if WITH_BHYVE
domaincapstest_LDADD += ../src/libvirt_driver_bhyve_impl.la
endif WITH_BHYVE
virnetmessagetest_SOURCES = \
virnetmessagetest.c testutils.h testutils.c
virnetmessagetest_LDADD = $(LDADDS)
@ -784,18 +584,6 @@ virnettlssessiontest_SOURCES += pkix_asn1_tab.c
virnettlssessiontest_LDADD += -ltasn1
endif HAVE_LIBTASN1
virtimetest_SOURCES = \
virtimetest.c testutils.h testutils.c
virtimetest_LDADD = $(LDADDS)
virschematest_SOURCES = \
virschematest.c testutils.h testutils.c
virschematest_LDADD = $(LDADDS) $(LIBXML_LIBS)
virstringtest_SOURCES = \
virstringtest.c testutils.h testutils.c
virstringtest_LDADD = $(LDADDS)
virstoragetest_SOURCES = \
virstoragetest.c testutils.h testutils.c
virstoragetest_LDADD = $(LDADDS) \
@ -812,42 +600,6 @@ viridentitytest_DEPENDENCIES = libsecurityselinuxhelper.la \
../src/libvirt.la
endif WITH_SELINUX
viriscsitest_SOURCES = \
viriscsitest.c testutils.h testutils.c
viriscsitest_LDADD = $(LDADDS)
virkeycodetest_SOURCES = \
virkeycodetest.c testutils.h testutils.c
virkeycodetest_LDADD = $(LDADDS)
virlockspacetest_SOURCES = \
virlockspacetest.c testutils.h testutils.c
virlockspacetest_LDADD = $(LDADDS)
virlogtest_SOURCES = \
virlogtest.c testutils.h testutils.c
virlogtest_LDADD = $(LDADDS)
virportallocatortest_SOURCES = \
virportallocatortest.c testutils.h testutils.c
virportallocatortest_LDADD = $(LDADDS)
vircgrouptest_SOURCES = \
vircgrouptest.c testutils.h testutils.c
vircgrouptest_LDADD = $(LDADDS)
vircryptotest_SOURCES = \
vircryptotest.c testutils.h testutils.c
vircryptotest_LDADD = $(LDADDS)
virhostdevtest_SOURCES = \
virhostdevtest.c testutils.h testutils.c
virhostdevtest_LDADD = $(LDADDS)
virpcitest_SOURCES = \
virpcitest.c testutils.h testutils.c
virpcitest_LDADD = $(LDADDS)
if WITH_LINUX
vircaps2xmltest_SOURCES = \
vircaps2xmltest.c testutils.h testutils.c virfilewrapper.h virfilewrapper.c
@ -910,15 +662,6 @@ test_programs += \
virnetdevopenvswitchtest
endif WITH_YAJL
virnetdevtest_SOURCES = \
virnetdevtest.c testutils.h testutils.c
virnetdevtest_CFLAGS = $(AM_CFLAGS) $(LIBNL_CFLAGS)
virnetdevtest_LDADD = $(LDADDS)
virrotatingfiletest_SOURCES = \
virrotatingfiletest.c testutils.h testutils.c
virrotatingfiletest_LDADD = $(LDADDS)
if WITH_LINUX
virusbtest_SOURCES = \
virusbtest.c testutils.h testutils.c
@ -946,22 +689,6 @@ virsystemdtest_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
virsystemdtest_LDADD = $(LDADDS) $(DBUS_LIBS)
endif WITH_DBUS
viruritest_SOURCES = \
viruritest.c testutils.h testutils.c
viruritest_LDADD = $(LDADDS)
viralloctest_SOURCES = \
viralloctest.c testutils.h testutils.c
viralloctest_LDADD = $(LDADDS)
virauthconfigtest_SOURCES = \
virauthconfigtest.c testutils.h testutils.c
virauthconfigtest_LDADD = $(LDADDS)
seclabeltest_SOURCES = \
seclabeltest.c testutils.h testutils.c
seclabeltest_LDADD = $(LDADDS)
if WITH_SECDRIVER_SELINUX
if WITH_ATTR
@ -982,43 +709,10 @@ endif WITH_QEMU
endif WITH_ATTR
endif WITH_SECDRIVER_SELINUX
virbuftest_SOURCES = \
virbuftest.c testutils.h testutils.c
virbuftest_LDADD = $(LDADDS)
virhashtest_SOURCES = \
virhashtest.c virhashdata.h testutils.h testutils.c
virhashtest_LDADD = $(LDADDS)
virbitmaptest_SOURCES = \
virbitmaptest.c testutils.h testutils.c
virbitmaptest_LDADD = $(LDADDS)
virendiantest_SOURCES = \
virendiantest.c testutils.h testutils.c
virendiantest_LDADD = $(LDADDS)
virfiletest_SOURCES = \
virfiletest.c testutils.h testutils.c
virfiletest_LDADD = $(LDADDS)
virfilecachetest_SOURCES = \
virfilecachetest.c testutils.h testutils.c
virfilecachetest_LDADD = $(LDADDS)
virfirewalltest_SOURCES = \
virfirewalltest.c testutils.h testutils.c
virfirewalltest_LDADD = $(LDADDS) $(DBUS_LIBS)
virfirewalltest_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
virjsontest_SOURCES = \
virjsontest.c testutils.h testutils.c
virjsontest_LDADD = $(LDADDS)
utiltest_SOURCES = \
utiltest.c testutils.h testutils.c
utiltest_LDADD = $(LDADDS)
if WITH_LIBVIRTD
virdrivermoduletest_SOURCES = \
virdrivermoduletest.c testutils.h testutils.c
@ -1035,33 +729,10 @@ eventtest_SOURCES = \
eventtest_LDADD = $(LDADDS)
endif WITH_LIBVIRTD
shunloadtest_SOURCES = \
shunloadtest.c
shunloadtest_LDADD = $(THREAD_LIBS) $(DLOPEN_LIBS)
shunloadtest_DEPENDENCIES = libshunload.la
sysinfotest_SOURCES = \
sysinfotest.c testutils.h testutils.c
sysinfotest_LDADD = $(LDADDS)
domainconftest_SOURCES = \
domainconftest.c testutils.h testutils.c
domainconftest_LDADD = $(LDADDS)
fdstreamtest_SOURCES = \
fdstreamtest.c testutils.h testutils.c
fdstreamtest_LDADD = $(LDADDS)
objecteventtest_SOURCES = \
objecteventtest.c \
testutils.c testutils.h
objecteventtest_LDADD = $(LDADDS)
virtypedparamtest_SOURCES = \
virtypedparamtest.c testutils.h testutils.c
virtypedparamtest_LDADD = $(LDADDS)
if WITH_LINUX
fchosttest_SOURCES = \
fchosttest.c testutils.h testutils.c

View File

@ -244,6 +244,95 @@ executable(
tests = []
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
vircapstest_link_with = []
vircapstest_link_whole = []
vircapstest_sources = [ 'vircapstest.c' ]
if conf.has('WITH_LXC')
vircapstest_link_with += [ lxc_driver_impl_lib ]
vircapstest_link_whole += [ test_utils_lxc_lib ]
endif
if conf.has('WITH_QEMU')
vircapstest_link_with += [ qemu_driver_impl ]
vircapstest_link_whole += [ test_utils_qemu_lib ]
vircapstest_sources += [ qemu_dtrace_gen_objects ]
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': 'metadatatest' },
{ 'name': 'networkxml2xmlupdatetest' },
{ 'name': 'nodedevxml2xmltest' },
{ 'name': 'nwfilterxml2xmltest' },
{ 'name': 'objecteventtest' },
{ 'name': 'seclabeltest' },
{ 'name': 'secretxml2xmltest' },
{ 'name': 'shunloadtest', 'deps': [ thread_dep ] },
{ 'name': 'sockettest' },
{ 'name': 'storagevolxml2xmltest' },
{ 'name': 'sysinfotest' },
{ 'name': 'utiltest' },
{ 'name': 'viralloctest' },
{ 'name': 'virauthconfigtest' },
{ 'name': 'virbitmaptest' },
{ 'name': 'virbuftest' },
{ 'name': 'vircapstest', 'sources': vircapstest_sources, 'link_with': vircapstest_link_with, 'link_whole': vircapstest_link_whole },
{ 'name': 'vircgrouptest' },
{ 'name': 'virconftest' },
{ 'name': 'vircryptotest' },
{ 'name': 'virendiantest' },
{ 'name': 'virerrortest' },
{ 'name': 'virfilecachetest' },
{ 'name': 'virfiletest' },
{ 'name': 'virfirewalltest', 'deps': [ dbus_dep ] },
{ 'name': 'virhashtest' },
{ 'name': 'virhostcputest', 'link_whole': [ test_file_wrapper_lib ] },
{ 'name': 'virhostdevtest' },
{ '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': 'virshtest' },
{ 'name': 'virstringtest' },
{ 'name': 'virtimetest' },
{ 'name': 'virtypedparamtest' },
{ 'name': 'viruritest' },
{ 'name': 'vshtabletest', 'link_with': [ libvirt_shell_lib ] },
]
foreach data : tests
test_sources = '@0@.c'.format(data['name'])
test_bin = executable(