mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-25 10:03:49 +03:00
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
This commit is contained in:
parent
9b3725627c
commit
ba5c9afffa
@ -238,6 +238,10 @@ reconnect_SOURCES = \
|
|||||||
reconnect.c
|
reconnect.c
|
||||||
reconnect_LDADD = $(LDADDS)
|
reconnect_LDADD = $(LDADDS)
|
||||||
|
|
||||||
|
statstest_SOURCES = \
|
||||||
|
statstest.c testutils.h testutils.c
|
||||||
|
statstest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)
|
||||||
|
|
||||||
else
|
else
|
||||||
EXTRA_DIST += xml2sexprtest.c sexpr2xmltest.c xmconfigtest.c \
|
EXTRA_DIST += xml2sexprtest.c sexpr2xmltest.c xmconfigtest.c \
|
||||||
xencapstest.c reconnect.c \
|
xencapstest.c reconnect.c \
|
||||||
@ -328,10 +332,6 @@ nodeinfotest_SOURCES = \
|
|||||||
nodeinfotest.c testutils.h testutils.c
|
nodeinfotest.c testutils.h testutils.c
|
||||||
nodeinfotest_LDADD = $(LDADDS)
|
nodeinfotest_LDADD = $(LDADDS)
|
||||||
|
|
||||||
statstest_SOURCES = \
|
|
||||||
statstest.c testutils.h testutils.c
|
|
||||||
statstest_LDADD = $(LDADDS)
|
|
||||||
|
|
||||||
if WITH_SECDRIVER_SELINUX
|
if WITH_SECDRIVER_SELINUX
|
||||||
seclabeltest_SOURCES = \
|
seclabeltest_SOURCES = \
|
||||||
seclabeltest.c
|
seclabeltest.c
|
||||||
|
@ -9,15 +9,12 @@
|
|||||||
#include "xen/block_stats.h"
|
#include "xen/block_stats.h"
|
||||||
#include "testutils.h"
|
#include "testutils.h"
|
||||||
|
|
||||||
#if WITH_XEN
|
|
||||||
static void testQuietError(void *userData ATTRIBUTE_UNUSED,
|
static void testQuietError(void *userData ATTRIBUTE_UNUSED,
|
||||||
virErrorPtr error ATTRIBUTE_UNUSED)
|
virErrorPtr error ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
/* nada */
|
/* nada */
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __linux__ && WITH_XEN
|
|
||||||
static int testDevice(const char *path, int expect)
|
static int testDevice(const char *path, int expect)
|
||||||
{
|
{
|
||||||
int actual = xenLinuxDomainDeviceID(NULL, 1, path);
|
int actual = xenLinuxDomainDeviceID(NULL, 1, path);
|
||||||
@ -43,14 +40,11 @@ static int testDeviceHelper(const void *data)
|
|||||||
return testDevice(info->dev, info->num);
|
return testDevice(info->dev, info->num);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mymain(int argc ATTRIBUTE_UNUSED,
|
mymain(int argc ATTRIBUTE_UNUSED,
|
||||||
char **argv ATTRIBUTE_UNUSED)
|
char **argv ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
#if __linux__ && WITH_XEN
|
|
||||||
/* Some of our tests delibrately test failure cases, so
|
/* Some of our tests delibrately test failure cases, so
|
||||||
* register a handler to stop error messages cluttering
|
* register a handler to stop error messages cluttering
|
||||||
* up display
|
* up display
|
||||||
@ -58,7 +52,7 @@ mymain(int argc ATTRIBUTE_UNUSED,
|
|||||||
if (!virTestGetDebug())
|
if (!virTestGetDebug())
|
||||||
virSetErrorFunc(NULL, testQuietError);
|
virSetErrorFunc(NULL, testQuietError);
|
||||||
|
|
||||||
# define DO_TEST(dev, num) \
|
#define DO_TEST(dev, num) \
|
||||||
do { \
|
do { \
|
||||||
struct testInfo info = { dev, num }; \
|
struct testInfo info = { dev, num }; \
|
||||||
if (virtTestRun("Device " dev " -> " # num, \
|
if (virtTestRun("Device " dev " -> " # num, \
|
||||||
@ -201,7 +195,6 @@ mymain(int argc ATTRIBUTE_UNUSED,
|
|||||||
DO_TEST("/dev/xvda1", 51713);
|
DO_TEST("/dev/xvda1", 51713);
|
||||||
DO_TEST("/dev/xvda15", 51727);
|
DO_TEST("/dev/xvda15", 51727);
|
||||||
|
|
||||||
#endif
|
|
||||||
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user