[libvirt] [PATCH] tests: Build and run storagevolxml2xmltest iff WITH_STORAGE

Michal Privoznik posted 1 patch 5 years, 2 months ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/df28965e4dad36a32ba6baa4e7b046b227139327.1548858651.git.mprivozn@redhat.com
tests/Makefile.am | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
[libvirt] [PATCH] tests: Build and run storagevolxml2xmltest iff WITH_STORAGE
Posted by Michal Privoznik 5 years, 2 months ago
Commit 7a227688a83880 assumes that libvirt_driver_storage_impl.la
is always available. Well it is not. Users have option to turn
the storage driver off in which case it isn't build and linking
the test with the library then fails.

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

And alternative approach might be to move only those test cases that
require WITH_STORAGE under #ifdef and link the library again only if
WITH_STORAGE is enabled. But this is harder to do properly - I mean
for future test cases it will be hard to decide whether to put them
inside or outside of WITH_STORAGE section.

 tests/Makefile.am | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index ab4c716529..c034fe0bf3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -368,6 +368,7 @@ if WITH_STORAGE
 test_programs += storagevolxml2argvtest
 test_programs += storagepoolxml2argvtest
 test_programs += virstorageutiltest
+test_programs += storagepoolxml2xmltest
 endif WITH_STORAGE
 
 if WITH_STORAGE_FS
@@ -384,7 +385,7 @@ test_programs += nsstest nssguesttest
 test_libraries += nssmock.la
 endif WITH_NSS
 
-test_programs += storagevolxml2xmltest storagepoolxml2xmltest
+test_programs += storagevolxml2xmltest
 
 test_programs += nodedevxml2xmltest
 
@@ -924,9 +925,17 @@ storagepoolxml2argvtest_LDADD = \
 	../src/libvirt_util.la \
 	$(LDADDS)
 
+storagepoolxml2xmltest_SOURCES = \
+	storagepoolxml2xmltest.c \
+	testutils.c testutils.h
+storagepoolxml2xmltest_LDADD = $(LDADDS) \
+	../src/libvirt_driver_storage_impl.la \
+	$(GNULIB_LIBS)
+
 else ! WITH_STORAGE
 EXTRA_DIST += storagevolxml2argvtest.c
 EXTRA_DIST += virstorageutiltest.c
+EXTRA_DIST += storagepoolxml2xmltest.c
 endif ! WITH_STORAGE
 
 storagevolxml2xmltest_SOURCES = \
@@ -934,13 +943,6 @@ storagevolxml2xmltest_SOURCES = \
 	testutils.c testutils.h
 storagevolxml2xmltest_LDADD = $(LDADDS)
 
-storagepoolxml2xmltest_SOURCES = \
-	storagepoolxml2xmltest.c \
-	testutils.c testutils.h
-storagepoolxml2xmltest_LDADD = $(LDADDS) \
-	../src/libvirt_driver_storage_impl.la \
-	$(GNULIB_LIBS)
-
 nodedevxml2xmltest_SOURCES = \
 	nodedevxml2xmltest.c \
 	testutils.c testutils.h
-- 
2.19.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] tests: Build and run storagevolxml2xmltest iff WITH_STORAGE
Posted by John Ferlan 5 years, 2 months ago

On 1/30/19 9:33 AM, Michal Privoznik wrote:
> Commit 7a227688a83880 assumes that libvirt_driver_storage_impl.la
> is always available. Well it is not. Users have option to turn
> the storage driver off in which case it isn't build and linking
> the test with the library then fails.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
> 
> And alternative approach might be to move only those test cases that
> require WITH_STORAGE under #ifdef and link the library again only if
> WITH_STORAGE is enabled. But this is harder to do properly - I mean
> for future test cases it will be hard to decide whether to put them
> inside or outside of WITH_STORAGE section.
> 
>  tests/Makefile.am | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 

haha - I just posted something along these lines...

I also note that I neglected to add storagepoolxml2argvtest to the !
WITH_STORAGE option that adds files to EXTRA_DIST

John

> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index ab4c716529..c034fe0bf3 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -368,6 +368,7 @@ if WITH_STORAGE
>  test_programs += storagevolxml2argvtest
>  test_programs += storagepoolxml2argvtest
>  test_programs += virstorageutiltest
> +test_programs += storagepoolxml2xmltest
>  endif WITH_STORAGE
>  
>  if WITH_STORAGE_FS
> @@ -384,7 +385,7 @@ test_programs += nsstest nssguesttest
>  test_libraries += nssmock.la
>  endif WITH_NSS
>  
> -test_programs += storagevolxml2xmltest storagepoolxml2xmltest
> +test_programs += storagevolxml2xmltest
>  
>  test_programs += nodedevxml2xmltest
>  
> @@ -924,9 +925,17 @@ storagepoolxml2argvtest_LDADD = \
>  	../src/libvirt_util.la \
>  	$(LDADDS)
>  
> +storagepoolxml2xmltest_SOURCES = \
> +	storagepoolxml2xmltest.c \
> +	testutils.c testutils.h
> +storagepoolxml2xmltest_LDADD = $(LDADDS) \
> +	../src/libvirt_driver_storage_impl.la \
> +	$(GNULIB_LIBS)
> +
>  else ! WITH_STORAGE
>  EXTRA_DIST += storagevolxml2argvtest.c
>  EXTRA_DIST += virstorageutiltest.c
> +EXTRA_DIST += storagepoolxml2xmltest.c
>  endif ! WITH_STORAGE
>  
>  storagevolxml2xmltest_SOURCES = \
> @@ -934,13 +943,6 @@ storagevolxml2xmltest_SOURCES = \
>  	testutils.c testutils.h
>  storagevolxml2xmltest_LDADD = $(LDADDS)
>  
> -storagepoolxml2xmltest_SOURCES = \
> -	storagepoolxml2xmltest.c \
> -	testutils.c testutils.h
> -storagepoolxml2xmltest_LDADD = $(LDADDS) \
> -	../src/libvirt_driver_storage_impl.la \
> -	$(GNULIB_LIBS)
> -
>  nodedevxml2xmltest_SOURCES = \
>  	nodedevxml2xmltest.c \
>  	testutils.c testutils.h
> 

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