From ba5c9afffafab401e2dd2f331422b64d8c7c6084 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Thu, 14 Oct 2010 13:22:18 +0100 Subject: [PATCH] Fix statstest when driver modules are enabled 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 | 8 ++++---- tests/statstest.c | 9 +-------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 64fac75712..44fe5796e9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 diff --git a/tests/statstest.c b/tests/statstest.c index 5fad190968..36cbea4ff3 100644 --- a/tests/statstest.c +++ b/tests/statstest.c @@ -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); }