[libvirt] [PATCH] fix --without-xen build

Daniel P. Berrange berrange at redhat.com
Mon Nov 24 15:50:33 UTC 2008


On Fri, Nov 21, 2008 at 12:46:59PM -0500, David Lively wrote:
> Okay, *this* one seems to be a complete fix.

Not quite. The ENABLE_XEN_TESTS conditional is only set when not
running on a live Xen kernel, which is a different conditional
from disabling Xen driver entirely. It also shouldn't skip out
sub-directories because we need 'make dist' to include them even
when Xen build is disabled.

Try out this patch which should do what you were after. It also removes
some pointless conditionals from the source files - we don't need WITH_XEN
in the source, if we're disabling the build entirely in the Makefile.am


Index: tests/Makefile.am
===================================================================
RCS file: /data/cvs/libvirt/tests/Makefile.am,v
retrieving revision 1.59
diff -u -p -r1.59 Makefile.am
--- tests/Makefile.am	24 Nov 2008 07:13:30 -0000	1.59
+++ tests/Makefile.am	24 Nov 2008 15:47:46 -0000
@@ -43,10 +43,13 @@ EXTRA_DIST =		\
 	nodeinfodata     \
 	domainschematest
 
-noinst_PROGRAMS = xmlrpctest xml2sexprtest sexpr2xmltest virshtest conftest \
-	reconnect xmconfigtest xencapstest \
+noinst_PROGRAMS = xmlrpctest virshtest conftest \
         nodeinfotest statstest qparamtest
 
+if WITH_XEN
+noinst_PROGRAMS += xml2sexprtest sexpr2xmltest \
+	reconnect xmconfigtest xencapstest
+endif
 if WITH_QEMU
 noinst_PROGRAMS += qemuxml2argvtest qemuxml2xmltest
 endif
@@ -68,12 +71,22 @@ endif
 
 EXTRA_DIST += $(test_scripts)
 
-TESTS = xml2sexprtest sexpr2xmltest virshtest xmconfigtest \
-        xencapstest nodeinfotest \
-	statstest qparamtest $(test_scripts)
+TESTS = virshtest \
+        nodeinfotest \
+	statstest \
+	qparamtest \
+	$(test_scripts)
+
+if WITH_XEN
+TESTS += xml2sexprtest \
+	sexpr2xmltest \
+	xmconfigtest \
+	xencapstest
 if ENABLE_XEN_TESTS
-  TESTS += reconnect
+TESTS += reconnect
+endif
 endif
+
 if WITH_QEMU
 TESTS += qemuxml2argvtest qemuxml2xmltest
 endif
@@ -105,6 +118,7 @@ xmlrpctest_SOURCES = \
 
 xmlrpctest_LDADD = $(LDADDS)
 
+if WITH_XEN
 xml2sexprtest_SOURCES = \
 	xml2sexprtest.c testutilsxen.c testutilsxen.h \
 	testutils.c testutils.h
@@ -120,6 +134,20 @@ xmconfigtest_SOURCES = \
 	testutils.c testutils.h
 xmconfigtest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)
 
+xencapstest_SOURCES = \
+	xencapstest.c testutils.h testutils.c
+xencapstest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)
+
+reconnect_SOURCES = \
+	reconnect.c
+reconnect_LDADD = $(LDADDS)
+
+else
+EXTRA_DIST += xml2sexprtest.c sexpr2xmltest.c xmconfigtest.c \
+	xencapstest.c reconnect.c \
+	testutilsxen.c testutilsxen.h
+endif
+
 if WITH_QEMU
 qemuxml2argvtest_SOURCES = \
 	qemuxml2argvtest.c testutilsqemu.c testutilsqemu.h \
@@ -143,10 +171,6 @@ conftest_SOURCES = \
 	conftest.c
 conftest_LDADD = $(LDADDS)
 
-xencapstest_SOURCES = \
-	xencapstest.c testutils.h testutils.c
-xencapstest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)
-
 nodeinfotest_SOURCES = \
 	nodeinfotest.c testutils.h testutils.c
 nodeinfotest_LDADD = $(LDADDS)
@@ -159,8 +183,4 @@ qparamtest_SOURCES = \
 	qparamtest.c testutils.h testutils.c
 qparamtest_LDADD = $(LDADDS)
 
-reconnect_SOURCES = \
-	reconnect.c
-reconnect_LDADD = $(LDADDS)
-
 CLEANFILES = *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda
Index: tests/sexpr2xmltest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/sexpr2xmltest.c,v
retrieving revision 1.32
diff -u -p -r1.32 sexpr2xmltest.c
--- tests/sexpr2xmltest.c	9 Sep 2008 13:53:58 -0000	1.32
+++ tests/sexpr2xmltest.c	24 Nov 2008 15:47:46 -0000
@@ -4,8 +4,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#ifdef WITH_XEN
-
 #include "internal.h"
 #include "xml.h"
 #include "xend_internal.h"
@@ -146,11 +144,3 @@ mymain(int argc, char **argv)
 
 VIRT_TEST_MAIN(mymain)
 
-#else /* WITHOUT_XEN */
-int
-main(void)
-{
-    fprintf(stderr, "libvirt compiled without Xen support\n");
-    return(0);
-}
-#endif /* WITH_XEN */
Index: tests/testutilsxen.c
===================================================================
RCS file: /data/cvs/libvirt/tests/testutilsxen.c,v
retrieving revision 1.2
diff -u -p -r1.2 testutilsxen.c
--- tests/testutilsxen.c	12 Aug 2008 08:25:48 -0000	1.2
+++ tests/testutilsxen.c	24 Nov 2008 15:47:46 -0000
@@ -1,6 +1,5 @@
 #include <config.h>
 
-#ifdef WITH_XEN
 #include <sys/utsname.h>
 #include <stdlib.h>
 
@@ -52,4 +51,3 @@ cleanup:
     virCapabilitiesFree(caps);
     return NULL;
 }
-#endif
Index: tests/xencapstest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/xencapstest.c,v
retrieving revision 1.15
diff -u -p -r1.15 xencapstest.c
--- tests/xencapstest.c	5 Sep 2008 11:35:44 -0000	1.15
+++ tests/xencapstest.c	24 Nov 2008 15:47:46 -0000
@@ -5,8 +5,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#ifdef WITH_XEN
-
 #include "internal.h"
 #include "xml.h"
 #include "testutils.h"
@@ -225,12 +223,3 @@ mymain(int argc, char **argv)
 
 VIRT_TEST_MAIN(mymain)
 
-#else /* !WITH_XEN */
-
-int
-main (void)
-{
-    exit (EXIT_SUCCESS);
-}
-
-#endif /* !WITH_XEN */
Index: tests/xmconfigtest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/xmconfigtest.c,v
retrieving revision 1.23
diff -u -p -r1.23 xmconfigtest.c
--- tests/xmconfigtest.c	21 Nov 2008 12:16:08 -0000	1.23
+++ tests/xmconfigtest.c	24 Nov 2008 15:47:46 -0000
@@ -27,8 +27,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#ifdef WITH_XEN
-
 #include "internal.h"
 #include "datatypes.h"
 #include "xen_unified.h"
@@ -239,11 +237,3 @@ mymain(int argc, char **argv)
 
 VIRT_TEST_MAIN(mymain)
 
-#else /* WITHOUT_XEN */
-int
-main(void)
-{
-    fprintf(stderr, "libvirt compiled without Xen support\n");
-    return(0);
-}
-#endif /* WITH_XEN */
Index: tests/xml2sexprtest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/xml2sexprtest.c,v
retrieving revision 1.31
diff -u -p -r1.31 xml2sexprtest.c
--- tests/xml2sexprtest.c	9 Sep 2008 13:53:58 -0000	1.31
+++ tests/xml2sexprtest.c	24 Nov 2008 15:47:46 -0000
@@ -8,8 +8,6 @@
 #include <fcntl.h>
 #include <unistd.h>
 
-#if WITH_XEN
-
 #include "internal.h"
 #include "xend_internal.h"
 #include "testutils.h"
@@ -155,8 +153,3 @@ mymain(int argc, char **argv)
 
 VIRT_TEST_MAIN(mymain)
 
-#else /* WITH_XEN */
-
-int main (void) { exit (77); /* means 'test skipped' for automake */ }
-
-#endif /* ! WITH_XEN */


-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list