In preparation libtool "-module" flag removal, add lib prefix to all
mock shared objects.
While at it, introduce VIR_TEST_MOCK macros that makes path out of mock
name to be used with VIR_TEST_PRELOAD or VIR_TEST_MAIN_PRELOAD. That,
hopefully, improves readability, reduces line length and allows to
tailor VIR_TEST_MOCK for specific platform if it has shared library
suffix different from ".so".
Signed-off-by: Roman Bolshakov <r.bolshakov(a)yadro.com>
---
tests/Makefile.am | 194 ++++++++++++++++-----------------
tests/bhyveargv2xmltest.c | 2 +-
tests/bhyvexml2argvtest.c | 2 +-
tests/bhyvexml2xmltest.c | 2 +-
tests/domaincapstest.c | 6 +-
tests/fchosttest.c | 2 +-
tests/libxlxml2domconfigtest.c | 2 +-
tests/nsstest.c | 2 +-
tests/qemucaps2xmltest.c | 2 +-
tests/qemucapsprobe.c | 2 +-
tests/qemumemlocktest.c | 3 +-
tests/qemumonitorjsontest.c | 2 +-
tests/qemuxml2argvtest.c | 8 +-
tests/qemuxml2xmltest.c | 6 +-
tests/testutils.c | 4 +-
tests/testutils.h | 4 +
tests/vircaps2xmltest.c | 2 +-
tests/vircgrouptest.c | 2 +-
tests/vircryptotest.c | 2 +-
tests/virfilecachetest.c | 2 +-
tests/virfiletest.c | 2 +-
tests/virfirewalltest.c | 2 +-
tests/virhostcputest.c | 2 +-
tests/virhostdevtest.c | 2 +-
tests/viriscsitest.c | 3 +-
tests/virmacmaptest.c | 2 +-
tests/virnetdaemontest.c | 2 +-
tests/virnetdevbandwidthtest.c | 2 +-
tests/virnetdevtest.c | 2 +-
tests/virnetserverclienttest.c | 2 +-
tests/virnettlscontexttest.c | 2 +-
tests/virnettlssessiontest.c | 2 +-
tests/virpcitest.c | 2 +-
tests/virpolkittest.c | 2 +-
tests/virportallocatortest.c | 2 +-
tests/virsystemdtest.c | 2 +-
tests/virusbtest.c | 2 +-
37 files changed, 143 insertions(+), 143 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6b5d05bbed..713dc30de3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -206,16 +206,16 @@ test_programs = virshtest sockettest \
$(NULL)
test_libraries = libshunload.la \
- virportallocatormock.la \
- virnetdaemonmock.la \
- virnetserverclientmock.la \
- vircgroupmock.la \
- virpcimock.la \
- virnetdevmock.la \
- virrandommock.la \
- virhostcpumock.la \
- domaincapsmock.la \
- virfilecachemock.la \
+ libvirportallocatormock.la \
+ libvirnetdaemonmock.la \
+ libvirnetserverclientmock.la \
+ libvircgroupmock.la \
+ libvirpcimock.la \
+ libvirnetdevmock.la \
+ libvirrandommock.la \
+ libvirhostcpumock.la \
+ libdomaincapsmock.la \
+ libvirfilecachemock.la \
$(NULL)
if WITH_REMOTE
@@ -234,11 +234,11 @@ test_programs += fchosttest
test_programs += scsihosttest
test_programs += vircaps2xmltest
test_programs += virresctrltest
-test_libraries += virusbmock.la \
- virnetdevbandwidthmock.la \
- virnumamock.la \
- virtestmock.la \
- virfilemock.la \
+test_libraries += libvirusbmock.la \
+ libvirnetdevbandwidthmock.la \
+ libvirnumamock.la \
+ libvirtestmock.la \
+ libvirfilemock.la \
$(NULL)
endif WITH_LINUX
@@ -250,7 +250,7 @@ if WITH_DBUS
test_programs += virdbustest \
virsystemdtest \
$(NULL)
-test_libraries += virdbusmock.la
+test_libraries += libvirdbusmock.la
if WITH_POLKIT
test_programs += virpolkittest
endif WITH_POLKIT
@@ -291,10 +291,10 @@ test_programs += qemuxml2argvtest qemuxml2xmltest \
test_helpers += qemucapsprobe
test_libraries += libqemumonitortestutils.la \
libqemutestdriver.la \
- qemuxml2argvmock.la \
- qemucaps2xmlmock.la \
- qemucapsprobemock.la \
- qemucpumock.la \
+ libqemuxml2argvmock.la \
+ libqemucaps2xmlmock.la \
+ libqemucapsprobemock.la \
+ libqemucpumock.la \
$(NULL)
endif WITH_QEMU
@@ -324,7 +324,7 @@ endif WITH_VMWARE
if WITH_BHYVE
test_programs += bhyvexml2argvtest bhyvexml2xmltest bhyveargv2xmltest
-test_libraries += bhyvexml2argvmock.la bhyveargv2xmlmock.la
+test_libraries += libbhyvexml2argvmock.la libbhyveargv2xmlmock.la
endif WITH_BHYVE
if WITH_CIL
@@ -379,7 +379,7 @@ endif WITH_LINUX
if WITH_NSS
test_helpers += nsslinktest nssguestlinktest
test_programs += nsstest nssguesttest
-test_libraries += nssmock.la
+test_libraries += libnssmock.la
endif WITH_NSS
test_programs += storagevolxml2xmltest
@@ -555,10 +555,10 @@ libqemutestdriver_la_SOURCES =
libqemutestdriver_la_LDFLAGS = $(DRIVERLIB_LDFLAGS)
libqemutestdriver_la_LIBADD = $(qemu_LDADDS)
-qemucpumock_la_SOURCES = \
+libqemucpumock_la_SOURCES = \
qemucpumock.c testutilshostcpus.h
-qemucpumock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-qemucpumock_la_LIBADD = $(MOCKLIBS_LIBS)
+libqemucpumock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libqemucpumock_la_LIBADD = $(MOCKLIBS_LIBS)
qemuxml2argvtest_SOURCES = \
qemuxml2argvtest.c testutilsqemu.c testutilsqemu.h \
@@ -568,10 +568,10 @@ qemuxml2argvtest_SOURCES = \
qemuxml2argvtest_LDADD = libqemutestdriver.la \
$(LDADDS) $(LIBXML_LIBS)
-qemuxml2argvmock_la_SOURCES = \
+libqemuxml2argvmock_la_SOURCES = \
qemuxml2argvmock.c
-qemuxml2argvmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-qemuxml2argvmock_la_LIBADD = $(MOCKLIBS_LIBS)
+libqemuxml2argvmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libqemuxml2argvmock_la_LIBADD = $(MOCKLIBS_LIBS)
qemuxml2xmltest_SOURCES = \
qemuxml2xmltest.c testutilsqemu.c testutilsqemu.h \
@@ -600,10 +600,10 @@ qemucapsprobe_SOURCES = \
qemucapsprobe_LDADD = \
libqemutestdriver.la $(LDADDS)
-qemucapsprobemock_la_SOURCES = \
+libqemucapsprobemock_la_SOURCES = \
qemucapsprobemock.c
-qemucapsprobemock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-qemucapsprobemock_la_LIBADD = $(MOCKLIBS_LIBS)
+libqemucapsprobemock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libqemucapsprobemock_la_LIBADD = $(MOCKLIBS_LIBS)
qemucommandutiltest_SOURCES = \
qemucommandutiltest.c \
@@ -620,10 +620,10 @@ qemucaps2xmltest_SOURCES = \
$(NULL)
qemucaps2xmltest_LDADD = $(qemu_LDADDS)
-qemucaps2xmlmock_la_SOURCES = \
+libqemucaps2xmlmock_la_SOURCES = \
qemucaps2xmlmock.c
-qemucaps2xmlmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-qemucaps2xmlmock_la_LIBADD = $(MOCKLIBS_LIBS)
+libqemucaps2xmlmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libqemucaps2xmlmock_la_LIBADD = $(MOCKLIBS_LIBS)
qemuagenttest_SOURCES = \
qemuagenttest.c \
@@ -780,15 +780,15 @@ EXTRA_DIST += vmwarevertest.c
endif ! WITH_VMWARE
if WITH_BHYVE
-bhyvexml2argvmock_la_SOURCES = \
+libbhyvexml2argvmock_la_SOURCES = \
bhyvexml2argvmock.c
-bhyvexml2argvmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-bhyvexml2argvmock_la_LIBADD = $(MOCKLIBS_LIBS)
+libbhyvexml2argvmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libbhyvexml2argvmock_la_LIBADD = $(MOCKLIBS_LIBS)
-bhyveargv2xmlmock_la_SOURCES = \
+libbhyveargv2xmlmock_la_SOURCES = \
bhyveargv2xmlmock.c
-bhyveargv2xmlmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-bhyveargv2xmlmock_la_LIBADD = $(MOCKLIBS_LIBS)
+libbhyveargv2xmlmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libbhyveargv2xmlmock_la_LIBADD = $(MOCKLIBS_LIBS)
bhyve_LDADDS = ../src/libvirt_driver_bhyve_impl.la
if WITH_STORAGE
@@ -1035,9 +1035,9 @@ else ! WITH_QEMU
vircapstest_LDADD = $(LDADDS)
endif ! WITH_QEMU
-domaincapsmock_la_SOURCES = domaincapsmock.c
-domaincapsmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-domaincapsmock_la_LIBADD = $(MOCKLIBS_LIBS)
+libdomaincapsmock_la_SOURCES = domaincapsmock.c
+libdomaincapsmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libdomaincapsmock_la_LIBADD = $(MOCKLIBS_LIBS)
domaincapstest_SOURCES = \
domaincapstest.c testutils.h testutils.c \
@@ -1072,20 +1072,20 @@ virnetdaemontest_SOURCES = \
testutils.h testutils.c
virnetdaemontest_LDADD = $(LDADDS)
-virnetdaemonmock_la_SOURCES = \
+libvirnetdaemonmock_la_SOURCES = \
virnetdaemonmock.c
-virnetdaemonmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-virnetdaemonmock_la_LIBADD = $(MOCKLIBS_LIBS)
+libvirnetdaemonmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libvirnetdaemonmock_la_LIBADD = $(MOCKLIBS_LIBS)
virnetserverclienttest_SOURCES = \
virnetserverclienttest.c \
testutils.h testutils.c
virnetserverclienttest_LDADD = $(LDADDS)
-virnetserverclientmock_la_SOURCES = \
+libvirnetserverclientmock_la_SOURCES = \
virnetserverclientmock.c
-virnetserverclientmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-virnetserverclientmock_la_LIBADD = $(MOCKLIBS_LIBS)
+libvirnetserverclientmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libvirnetserverclientmock_la_LIBADD = $(MOCKLIBS_LIBS)
virnettlscontexttest_SOURCES = \
virnettlscontexttest.c \
@@ -1157,19 +1157,19 @@ virportallocatortest_SOURCES = \
virportallocatortest.c testutils.h testutils.c
virportallocatortest_LDADD = $(LDADDS)
-virportallocatormock_la_SOURCES = \
+libvirportallocatormock_la_SOURCES = \
virportallocatormock.c
-virportallocatormock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-virportallocatormock_la_LIBADD = $(MOCKLIBS_LIBS)
+libvirportallocatormock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libvirportallocatormock_la_LIBADD = $(MOCKLIBS_LIBS)
vircgrouptest_SOURCES = \
vircgrouptest.c testutils.h testutils.c
vircgrouptest_LDADD = $(LDADDS)
-vircgroupmock_la_SOURCES = \
+libvircgroupmock_la_SOURCES = \
vircgroupmock.c
-vircgroupmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-vircgroupmock_la_LIBADD = $(MOCKLIBS_LIBS)
+libvircgroupmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libvircgroupmock_la_LIBADD = $(MOCKLIBS_LIBS)
vircryptotest_SOURCES = \
vircryptotest.c testutils.h testutils.c
@@ -1183,44 +1183,44 @@ virpcitest_SOURCES = \
virpcitest.c testutils.h testutils.c
virpcitest_LDADD = $(LDADDS)
-virpcimock_la_SOURCES = \
+libvirpcimock_la_SOURCES = \
virpcimock.c
-virpcimock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-virpcimock_la_LIBADD = $(MOCKLIBS_LIBS)
+libvirpcimock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libvirpcimock_la_LIBADD = $(MOCKLIBS_LIBS)
-virrandommock_la_SOURCES = \
+libvirrandommock_la_SOURCES = \
virrandommock.c
-virrandommock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-virrandommock_la_LIBADD = $(MOCKLIBS_LIBS)
+libvirrandommock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libvirrandommock_la_LIBADD = $(MOCKLIBS_LIBS)
-virhostcpumock_la_SOURCES = \
+libvirhostcpumock_la_SOURCES = \
virhostcpumock.c
-virhostcpumock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-virhostcpumock_la_LIBADD = $(MOCKLIBS_LIBS)
+libvirhostcpumock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libvirhostcpumock_la_LIBADD = $(MOCKLIBS_LIBS)
-virfilecachemock_la_SOURCES = \
+libvirfilecachemock_la_SOURCES = \
virfilecachemock.c
-virfilecachemock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-virfilecachemock_la_LIBADD = $(MOCKLIBS_LIBS)
+libvirfilecachemock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libvirfilecachemock_la_LIBADD = $(MOCKLIBS_LIBS)
if WITH_LINUX
vircaps2xmltest_SOURCES = \
vircaps2xmltest.c testutils.h testutils.c virfilewrapper.h virfilewrapper.c
vircaps2xmltest_LDADD = $(LDADDS)
-virnumamock_la_SOURCES = \
+libvirnumamock_la_SOURCES = \
virnumamock.c
-virnumamock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-virnumamock_la_LIBADD = $(MOCKLIBS_LIBS)
+libvirnumamock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libvirnumamock_la_LIBADD = $(MOCKLIBS_LIBS)
virresctrltest_SOURCES = \
virresctrltest.c testutils.h testutils.c virfilewrapper.h virfilewrapper.c
virresctrltest_LDADD = $(LDADDS)
-virfilemock_la_SOURCES = \
+libvirfilemock_la_SOURCES = \
virfilemock.c
-virfilemock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-virfilemock_la_LIBADD = $(MOCKLIBS_LIBS)
+libvirfilemock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libvirfilemock_la_LIBADD = $(MOCKLIBS_LIBS)
else ! WITH_LINUX
EXTRA_DIST += vircaps2xmltest.c virnumamock.c virfilewrapper.c \
virfilewrapper.h virresctrltest.c virfilemock.c
@@ -1246,10 +1246,10 @@ nssguesttest_LDADD = \
$(LDADDS) \
../tools/nss/libnss_libvirt_guest_impl.la
-nssmock_la_SOURCES = \
+libnssmock_la_SOURCES = \
nssmock.c
-nssmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-nssmock_la_LIBADD = $(MOCKLIBS_LIBS)
+libnssmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libnssmock_la_LIBADD = $(MOCKLIBS_LIBS)
## Intentionaly not linking with anything else.
## See the test source for more detailed explanation.
@@ -1271,12 +1271,12 @@ else ! WITH_NSS
EXTRA_DIST += nsstest.c nssmock.c nsslinktest.c
endif ! WITH_NSS
-virdeterministichashmock_la_SOURCES = \
+libvirdeterministichashmock_la_SOURCES = \
virdeterministichashmock.c
-virdeterministichashmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-virdeterministichashmock_la_LIBADD = $(MOCKLIBS_LIBS)
+libvirdeterministichashmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libvirdeterministichashmock_la_LIBADD = $(MOCKLIBS_LIBS)
-test_libraries += virdeterministichashmock.la
+test_libraries += libvirdeterministichashmock.la
if WITH_YAJL
virmacmaptest_SOURCES = \
@@ -1301,11 +1301,11 @@ virnetdevtest_SOURCES = \
virnetdevtest_CFLAGS = $(AM_CFLAGS) $(LIBNL_CFLAGS)
virnetdevtest_LDADD = $(LDADDS)
-virnetdevmock_la_SOURCES = \
+libvirnetdevmock_la_SOURCES = \
virnetdevmock.c
-virnetdevmock_la_CFLAGS = $(AM_CFLAGS) $(LIBNL_CFLAGS)
-virnetdevmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-virnetdevmock_la_LIBADD = $(MOCKLIBS_LIBS)
+libvirnetdevmock_la_CFLAGS = $(AM_CFLAGS) $(LIBNL_CFLAGS)
+libvirnetdevmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libvirnetdevmock_la_LIBADD = $(MOCKLIBS_LIBS)
virrotatingfiletest_SOURCES = \
virrotatingfiletest.c testutils.h testutils.c
@@ -1320,21 +1320,21 @@ virnetdevbandwidthtest_SOURCES = \
virnetdevbandwidthtest.c testutils.h testutils.c
virnetdevbandwidthtest_LDADD = $(LDADDS) $(LIBXML_LIBS)
-virusbmock_la_SOURCES = virusbmock.c
-virusbmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-virusbmock_la_LIBADD = $(MOCKLIBS_LIBS) \
+libvirusbmock_la_SOURCES = virusbmock.c
+libvirusbmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libvirusbmock_la_LIBADD = $(MOCKLIBS_LIBS) \
$(PROBES_O) \
../src/libvirt_util.la
-virnetdevbandwidthmock_la_SOURCES = \
+libvirnetdevbandwidthmock_la_SOURCES = \
virnetdevbandwidthmock.c
-virnetdevbandwidthmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-virnetdevbandwidthmock_la_LIBADD = $(MOCKLIBS_LIBS)
+libvirnetdevbandwidthmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libvirnetdevbandwidthmock_la_LIBADD = $(MOCKLIBS_LIBS)
-virtestmock_la_SOURCES = \
+libvirtestmock_la_SOURCES = \
virtestmock.c
-virtestmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-virtestmock_la_LIBADD = \
+libvirtestmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libvirtestmock_la_LIBADD = \
$(MOCKLIBS_LIBS) \
$(PROBES_O) \
../src/libvirt_util.la
@@ -1350,11 +1350,11 @@ virdbustest_SOURCES = \
virdbustest_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
virdbustest_LDADD = $(LDADDS) $(DBUS_LIBS)
-virdbusmock_la_SOURCES = \
+libvirdbusmock_la_SOURCES = \
virdbusmock.c
-virdbusmock_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
-virdbusmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-virdbusmock_la_LIBADD = $(MOCKLIBS_LIBS)
+libvirdbusmock_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
+libvirdbusmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+libvirdbusmock_la_LIBADD = $(MOCKLIBS_LIBS)
virpolkittest_SOURCES = \
virpolkittest.c testutils.h testutils.c
diff --git a/tests/bhyveargv2xmltest.c b/tests/bhyveargv2xmltest.c
index d552364846..8e29225e31 100644
--- a/tests/bhyveargv2xmltest.c
+++ b/tests/bhyveargv2xmltest.c
@@ -205,7 +205,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/bhyveargv2xmlmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("bhyveargv2xml"))
#else
diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c
index c84925c57b..14ceac052e 100644
--- a/tests/bhyvexml2argvtest.c
+++ b/tests/bhyvexml2argvtest.c
@@ -258,7 +258,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/bhyvexml2argvmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("bhyvexml2argv"))
#else
diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c
index e8a6867fcd..66394e2ae4 100644
--- a/tests/bhyvexml2xmltest.c
+++ b/tests/bhyvexml2xmltest.c
@@ -135,7 +135,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/bhyvexml2argvmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("bhyvexml2argv"))
#else
diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
index 45ecfe61ac..c9cbf6ef8a 100644
--- a/tests/domaincapstest.c
+++ b/tests/domaincapstest.c
@@ -488,8 +488,8 @@ mymain(void)
#if WITH_QEMU
VIR_TEST_MAIN_PRELOAD(mymain,
- abs_builddir "/.libs/domaincapsmock.so",
- abs_builddir "/.libs/qemucpumock.so")
+ VIR_TEST_MOCK("domaincaps"),
+ VIR_TEST_MOCK("qemucpu"))
#else
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/domaincapsmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("domaincaps"))
#endif
diff --git a/tests/fchosttest.c b/tests/fchosttest.c
index 3ee1912926..05272a2e9e 100644
--- a/tests/fchosttest.c
+++ b/tests/fchosttest.c
@@ -382,4 +382,4 @@ mymain(void)
return ret;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virrandommock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virrandom"))
diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
index 048e6c0431..3b3f63403e 100644
--- a/tests/libxlxml2domconfigtest.c
+++ b/tests/libxlxml2domconfigtest.c
@@ -221,7 +221,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/libxlmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("xl"))
#else
diff --git a/tests/nsstest.c b/tests/nsstest.c
index 4118c31cef..734e4cbc07 100644
--- a/tests/nsstest.c
+++ b/tests/nsstest.c
@@ -190,7 +190,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/nssmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("nss"))
#else
int
main(void)
diff --git a/tests/qemucaps2xmltest.c b/tests/qemucaps2xmltest.c
index 08dc598541..3b381251a0 100644
--- a/tests/qemucaps2xmltest.c
+++ b/tests/qemucaps2xmltest.c
@@ -217,4 +217,4 @@ mymain(void)
return (data.ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/qemucaps2xmlmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("qemucaps2xml"))
diff --git a/tests/qemucapsprobe.c b/tests/qemucapsprobe.c
index 14c0ecad97..ae016c47c2 100644
--- a/tests/qemucapsprobe.c
+++ b/tests/qemucapsprobe.c
@@ -47,7 +47,7 @@ main(int argc, char **argv)
virThread thread;
virQEMUCapsPtr caps;
- VIR_TEST_PRELOAD(abs_builddir "/.libs/qemucapsprobemock.so");
+ VIR_TEST_PRELOAD(VIR_TEST_MOCK("qemucapsprobe"));
if (argc != 2) {
fprintf(stderr, "%s QEMU_binary\n", argv[0]);
diff --git a/tests/qemumemlocktest.c b/tests/qemumemlocktest.c
index 42a4643338..c9484ac9cb 100644
--- a/tests/qemumemlocktest.c
+++ b/tests/qemumemlocktest.c
@@ -155,8 +155,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain,
- abs_builddir "/.libs/virpcimock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virpci"))
#else
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 522ff5a3d5..07832de3f1 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -3298,4 +3298,4 @@ mymain(void)
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir
"/.libs/virdeterministichashmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virdeterministichash"))
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 2554d848cf..1799eb3387 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2994,10 +2994,10 @@ mymain(void)
}
VIR_TEST_MAIN_PRELOAD(mymain,
- abs_builddir "/.libs/qemuxml2argvmock.so",
- abs_builddir "/.libs/virrandommock.so",
- abs_builddir "/.libs/qemucpumock.so",
- abs_builddir "/.libs/virpcimock.so")
+ VIR_TEST_MOCK("qemuxml2argv"),
+ VIR_TEST_MOCK("virrandom"),
+ VIR_TEST_MOCK("qemucpu"),
+ VIR_TEST_MOCK("virpci"))
#else
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index d7850a89d3..cf46bb330f 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1343,9 +1343,9 @@ mymain(void)
}
VIR_TEST_MAIN_PRELOAD(mymain,
- abs_builddir "/.libs/virpcimock.so",
- abs_builddir "/.libs/virrandommock.so",
- abs_builddir "/.libs/virdeterministichashmock.so")
+ VIR_TEST_MOCK("virpci"),
+ VIR_TEST_MOCK("virrandom"),
+ VIR_TEST_MOCK("virdeterministichash"))
#else
diff --git a/tests/testutils.c b/tests/testutils.c
index 245b1832f6..1fda3763f9 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -962,8 +962,6 @@ virTestSetEnvPath(void)
return ret;
}
-#define TEST_MOCK (abs_builddir "/.libs/virtestmock.so")
-
int virTestMain(int argc,
char **argv,
int (*func)(void),
@@ -981,7 +979,7 @@ int virTestMain(int argc,
virLogOutputPtr *outputs = NULL;
if (getenv("VIR_TEST_FILE_ACCESS"))
- VIR_TEST_PRELOAD(TEST_MOCK);
+ VIR_TEST_PRELOAD(VIR_TEST_MOCK("virtest"));
va_start(ap, func);
while ((lib = va_arg(ap, const char *)))
diff --git a/tests/testutils.h b/tests/testutils.h
index 07dda6e355..e0fa2b2448 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -148,6 +148,10 @@ int virTestMain(int argc,
return virTestMain(argc, argv, func, __VA_ARGS__, NULL); \
}
+#define MOCK_EXT ".so"
+
+#define VIR_TEST_MOCK(mock) (abs_builddir "/.libs/lib" mock "mock"
MOCK_EXT)
+
virCapsPtr virTestGenericCapsInit(void);
int virTestCapsBuildNUMATopology(virCapsPtr caps,
int seq);
diff --git a/tests/vircaps2xmltest.c b/tests/vircaps2xmltest.c
index fc112db0bc..41e84a3b25 100644
--- a/tests/vircaps2xmltest.c
+++ b/tests/vircaps2xmltest.c
@@ -116,4 +116,4 @@ mymain(void)
return ret;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virnumamock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virnuma"))
diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
index 20f4c57b04..e862b132f0 100644
--- a/tests/vircgrouptest.c
+++ b/tests/vircgrouptest.c
@@ -1136,7 +1136,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/vircgroupmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("vircgroup"))
#else
int
diff --git a/tests/vircryptotest.c b/tests/vircryptotest.c
index 6841d74901..42ef0b8900 100644
--- a/tests/vircryptotest.c
+++ b/tests/vircryptotest.c
@@ -179,4 +179,4 @@ mymain(void)
}
/* Forces usage of not so random virRandomBytes */
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virrandommock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virrandom"))
diff --git a/tests/virfilecachetest.c b/tests/virfilecachetest.c
index 08062d66e3..a17086e004 100644
--- a/tests/virfilecachetest.c
+++ b/tests/virfilecachetest.c
@@ -233,4 +233,4 @@ mymain(void)
return ret != 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virfilecachemock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virfilecache"))
diff --git a/tests/virfiletest.c b/tests/virfiletest.c
index aa4c3435e5..14be2d9d60 100644
--- a/tests/virfiletest.c
+++ b/tests/virfiletest.c
@@ -464,7 +464,7 @@ mymain(void)
}
#ifdef __linux__
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virfilemock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virfile"))
#else
VIR_TEST_MAIN(mymain)
#endif
diff --git a/tests/virfirewalltest.c b/tests/virfirewalltest.c
index 7c586877d3..78685a3bf4 100644
--- a/tests/virfirewalltest.c
+++ b/tests/virfirewalltest.c
@@ -1198,7 +1198,7 @@ mymain(void)
}
# if WITH_DBUS
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virdbusmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virdbus"))
# else
VIR_TEST_MAIN(mymain)
# endif
diff --git a/tests/virhostcputest.c b/tests/virhostcputest.c
index bb60dd3ffc..9ee0d2f15b 100644
--- a/tests/virhostcputest.c
+++ b/tests/virhostcputest.c
@@ -276,6 +276,6 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virhostcpumock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virhostcpu"))
#endif /* __linux__ */
diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
index f860426678..d0859a421c 100644
--- a/tests/virhostdevtest.c
+++ b/tests/virhostdevtest.c
@@ -597,7 +597,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virpcimock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virpci"))
#else
int
main(void)
diff --git a/tests/viriscsitest.c b/tests/viriscsitest.c
index cc552a5cfe..1ce039425b 100644
--- a/tests/viriscsitest.c
+++ b/tests/viriscsitest.c
@@ -365,6 +365,5 @@ mymain(void)
return EXIT_SUCCESS;
}
-VIR_TEST_MAIN_PRELOAD(mymain,
- abs_builddir "/.libs/virrandommock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virrandom"))
#endif /* WIN32 */
diff --git a/tests/virmacmaptest.c b/tests/virmacmaptest.c
index 884dabab82..995aff1178 100644
--- a/tests/virmacmaptest.c
+++ b/tests/virmacmaptest.c
@@ -232,4 +232,4 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir
"/.libs/virdeterministichashmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virdeterministichash"))
diff --git a/tests/virnetdaemontest.c b/tests/virnetdaemontest.c
index 816bfe05d4..0a75568902 100644
--- a/tests/virnetdaemontest.c
+++ b/tests/virnetdaemontest.c
@@ -416,7 +416,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virnetdaemonmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virnetdaemon"))
#else
static int
mymain(void)
diff --git a/tests/virnetdevbandwidthtest.c b/tests/virnetdevbandwidthtest.c
index 2c0b6a6713..59647173c3 100644
--- a/tests/virnetdevbandwidthtest.c
+++ b/tests/virnetdevbandwidthtest.c
@@ -166,4 +166,4 @@ mymain(void)
return ret;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virnetdevbandwidthmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virnetdevbandwidth"))
diff --git a/tests/virnetdevtest.c b/tests/virnetdevtest.c
index 24fb4d35e0..5d266a28ee 100644
--- a/tests/virnetdevtest.c
+++ b/tests/virnetdevtest.c
@@ -82,7 +82,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virnetdevmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virnetdev"))
#else
int
main(void)
diff --git a/tests/virnetserverclienttest.c b/tests/virnetserverclienttest.c
index cb5071b2d9..4d7c6555b9 100644
--- a/tests/virnetserverclienttest.c
+++ b/tests/virnetserverclienttest.c
@@ -170,7 +170,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virnetserverclientmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virnetserverclient"))
#else
static int
mymain(void)
diff --git a/tests/virnettlscontexttest.c b/tests/virnettlscontexttest.c
index 07910c2749..9a0d947c1b 100644
--- a/tests/virnettlscontexttest.c
+++ b/tests/virnettlscontexttest.c
@@ -630,7 +630,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virrandommock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virrandom"))
#else
diff --git a/tests/virnettlssessiontest.c b/tests/virnettlssessiontest.c
index 41abbe7eaf..8d89b16814 100644
--- a/tests/virnettlssessiontest.c
+++ b/tests/virnettlssessiontest.c
@@ -484,7 +484,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virrandommock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virrandom"))
#else
diff --git a/tests/virpcitest.c b/tests/virpcitest.c
index 0bd37268ef..12b142700a 100644
--- a/tests/virpcitest.c
+++ b/tests/virpcitest.c
@@ -420,7 +420,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virpcimock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virpci"))
#else
int
main(void)
diff --git a/tests/virpolkittest.c b/tests/virpolkittest.c
index 94a6daae0c..ce1ff92bf2 100644
--- a/tests/virpolkittest.c
+++ b/tests/virpolkittest.c
@@ -347,7 +347,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virdbusmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virdbus"))
#else /* ! __ELF__ */
int
diff --git a/tests/virportallocatortest.c b/tests/virportallocatortest.c
index 211de705a4..c695b26859 100644
--- a/tests/virportallocatortest.c
+++ b/tests/virportallocatortest.c
@@ -182,7 +182,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virportallocatormock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virportallocator"))
#else /* defined(__linux__) && defined(RTLD_NEXT) */
int
main(void)
diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c
index 2dafce2764..3add1ab56f 100644
--- a/tests/virsystemdtest.c
+++ b/tests/virsystemdtest.c
@@ -783,7 +783,7 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virdbusmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virdbus"))
#else /* ! (WITH_DBUS && __linux__) */
int
diff --git a/tests/virusbtest.c b/tests/virusbtest.c
index 564c4b44a4..1f04f283f5 100644
--- a/tests/virusbtest.c
+++ b/tests/virusbtest.c
@@ -288,4 +288,4 @@ mymain(void)
return EXIT_SUCCESS;
}
-VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virusbmock.so")
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virusb"))
--
2.22.0