[libvirt] [PATCH] tests: stop static linking to libvirt code in tests

Daniel P. Berrangé posted 1 patch 4 years, 3 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20191203152544.1458207-1-berrange@redhat.com
src/libvirt_private.syms |  2 ++
tests/Makefile.am        | 11 +++--------
2 files changed, 5 insertions(+), 8 deletions(-)
[libvirt] [PATCH] tests: stop static linking to libvirt code in tests
Posted by Daniel P. Berrangé 4 years, 3 months ago
If we static link to libvirt_util.la then we can't override functions in
this file by simply implementing them in the test code. Any tests should
dynamic link to the main libvirt.la and ensure symbols are exported.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 src/libvirt_private.syms |  2 ++
 tests/Makefile.am        | 11 +++--------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 8fe0bf9365..0864de030b 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -915,6 +915,8 @@ virDomainSnapshotDefFormat;
 virDomainSnapshotDefIsExternal;
 virDomainSnapshotDefNew;
 virDomainSnapshotDefParseString;
+virDomainSnapshotDiskDefFree;
+virDomainSnapshotDiskDefParseXML;
 virDomainSnapshotFormatConvertXMLFlags;
 virDomainSnapshotIsExternal;
 virDomainSnapshotLocationTypeFromString;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e009de830c..af8fd69842 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -662,8 +662,7 @@ qemublocktest_SOURCES = \
 	$(NULL)
 qemublocktest_LDADD = \
 	libqemumonitortestutils.la \
-	../src/libvirt_conf.la \
-	../src/libvirt_util.la \
+	../src/libvirt.la \
 	$(qemu_LDADDS) \
 	$(NULL)
 
@@ -939,8 +938,7 @@ storagevolxml2argvtest_SOURCES = \
 storagevolxml2argvtest_LDADD = \
 	$(LIBXML_LIBS) \
 	../src/libvirt_driver_storage_impl.la \
-	../src/libvirt_conf.la \
-	../src/libvirt_util.la \
+	../src/libvirt.la \
 	$(LDADDS)
 
 storagepoolxml2argvtest_SOURCES = \
@@ -949,8 +947,7 @@ storagepoolxml2argvtest_SOURCES = \
 storagepoolxml2argvtest_LDADD = \
 	$(LIBXML_LIBS) \
 	../src/libvirt_driver_storage_impl.la \
-	../src/libvirt_conf.la \
-	../src/libvirt_util.la \
+	../src/libvirt.la \
 	$(LDADDS)
 
 storagepoolxml2xmltest_SOURCES = \
@@ -1150,8 +1147,6 @@ virstoragetest_SOURCES = \
 	virstoragetest.c testutils.h testutils.c
 virstoragetest_LDADD = $(LDADDS) \
 	../src/libvirt.la \
-	../src/libvirt_conf.la \
-	../src/libvirt_util.la \
 	../src/libvirt_driver_storage_impl.la \
 	../gnulib/lib/libgnu.la \
 	$(NULL)
-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] tests: stop static linking to libvirt code in tests
Posted by Michal Privoznik 4 years, 3 months ago
On 12/3/19 4:25 PM, Daniel P. Berrangé wrote:
> If we static link to libvirt_util.la then we can't override functions in
> this file by simply implementing them in the test code. Any tests should
> dynamic link to the main libvirt.la and ensure symbols are exported.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   src/libvirt_private.syms |  2 ++
>   tests/Makefile.am        | 11 +++--------
>   2 files changed, 5 insertions(+), 8 deletions(-)

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list