]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix statstest when driver modules are enabled
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 14 Oct 2010 12:22:18 +0000 (13:22 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 19 Oct 2010 16:31:30 +0000 (17:31 +0100)
The statstest is xen specific. Instead of filling the code with
a huge number of #ifdef WITH_XEN, just make its entire compilation
conditional in the Makefile.am. Also ensure it links to the Xen
driver so that it builds when driver modules are enabled

* tests/Makefile.am: Make statstest xen conditional. Link to
  xen driver
* tests/Makefile.am: Remove all conditionals

tests/Makefile.am
tests/statstest.c

index 64fac75712c09284e2b7d1aa5a1b339d86b34ecf..44fe5796e9ae25f656ff8248afc5effbdb53dc72 100644 (file)
@@ -238,6 +238,10 @@ reconnect_SOURCES = \
        reconnect.c
 reconnect_LDADD = $(LDADDS)
 
+statstest_SOURCES = \
+       statstest.c testutils.h testutils.c
+statstest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)
+
 else
 EXTRA_DIST += xml2sexprtest.c sexpr2xmltest.c xmconfigtest.c \
        xencapstest.c reconnect.c \
@@ -328,10 +332,6 @@ nodeinfotest_SOURCES = \
        nodeinfotest.c testutils.h testutils.c
 nodeinfotest_LDADD = $(LDADDS)
 
-statstest_SOURCES = \
-       statstest.c testutils.h testutils.c
-statstest_LDADD = $(LDADDS)
-
 if WITH_SECDRIVER_SELINUX
 seclabeltest_SOURCES = \
        seclabeltest.c
index 5fad190968f6c9e4305e2ab059de3fc30fe02658..36cbea4ff3f810722b64ada74663543661721338 100644 (file)
@@ -9,15 +9,12 @@
 #include "xen/block_stats.h"
 #include "testutils.h"
 
-#if WITH_XEN
 static void testQuietError(void *userData ATTRIBUTE_UNUSED,
                            virErrorPtr error ATTRIBUTE_UNUSED)
 {
     /* nada */
 }
-#endif
 
-#if __linux__ && WITH_XEN
 static int testDevice(const char *path, int expect)
 {
     int actual = xenLinuxDomainDeviceID(NULL, 1, path);
@@ -43,14 +40,11 @@ static int testDeviceHelper(const void *data)
     return testDevice(info->dev, info->num);
 }
 
-#endif
-
 static int
 mymain(int argc ATTRIBUTE_UNUSED,
        char **argv ATTRIBUTE_UNUSED)
 {
     int ret = 0;
-#if __linux__ && WITH_XEN
     /* Some of our tests delibrately test failure cases, so
      * register a handler to stop error messages cluttering
      * up display
@@ -58,7 +52,7 @@ mymain(int argc ATTRIBUTE_UNUSED,
     if (!virTestGetDebug())
         virSetErrorFunc(NULL, testQuietError);
 
-# define DO_TEST(dev, num)                                              \
+#define DO_TEST(dev, num)                                              \
     do {                                                               \
         struct testInfo info = { dev, num };                           \
         if (virtTestRun("Device " dev " -> " # num,                    \
@@ -201,7 +195,6 @@ mymain(int argc ATTRIBUTE_UNUSED,
     DO_TEST("/dev/xvda1", 51713);
     DO_TEST("/dev/xvda15", 51727);
 
-#endif
     return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }