提交 a7c1eb14 编写于 作者: R Roman Bogorodskiy 提交者: Michal Privoznik

vircapstest: fix build without LXC, QEMU or XEN

When building without lxc support enabled, build fails with:

CLD     vircapstest
vircapstest.o: In function `test_virCapsDomainDataLookupLXC':
vircapstest.c:(.text+0x9ef): undefined reference to `testLXCCapsInit'

Fix that by hiding LXC tests under appropriate #ifdef. Same applies
for QEMU and XEN.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 98322052
......@@ -877,11 +877,16 @@ virkmodtest_SOURCES = \
virkmodtest_LDADD = $(LDADDS)
vircapstest_SOURCES = \
vircapstest.c testutils.h testutils.c \
testutilsqemu.c testutilsqemu.h \
testutilslxc.c testutilslxc.h \
testutilsxen.c testutilsxen.h \
$(NULL)
vircapstest.c testutils.h testutils.c
if WITH_LXC
vircapstest_SOURCES += testutilslxc.c testutilslxc.h
endif WITH_LXC
if WITH_QEMU
vircapstest_SOURCES += testutilsqemu.c testutilsqemu.h
endif WITH_QEMU
if WITH_XEN
vircapstest_SOURCES += testutilsxen.c testutilsxen.h
endif WITH_XEN
vircapstest_LDADD = $(qemu_LDADDS) $(LDADDS)
vircaps2xmltest_SOURCES = \
......
......@@ -38,7 +38,7 @@
/*
* Build NUMA Toplogy with cell id starting from (0 + seq)
* for testing
*/
*/
static virCapsPtr
buildNUMATopology(int seq)
{
......@@ -121,7 +121,7 @@ test_virCapabilitiesGetCpusForNodemask(const void *data ATTRIBUTE_UNUSED)
}
static bool
static bool ATTRIBUTE_UNUSED
doCapsExpectFailure(virCapsPtr caps,
int ostype,
virArch arch,
......@@ -140,7 +140,7 @@ doCapsExpectFailure(virCapsPtr caps,
return true;
}
static bool
static bool ATTRIBUTE_UNUSED
doCapsCompare(virCapsPtr caps,
int ostype,
virArch arch,
......@@ -210,6 +210,7 @@ doCapsCompare(virCapsPtr caps,
if (!doCapsExpectFailure(caps, o, a, d, e, m)) \
ret = 1;
#ifdef WITH_QEMU
static int
test_virCapsDomainDataLookupQEMU(const void *data ATTRIBUTE_UNUSED)
{
......@@ -262,7 +263,9 @@ test_virCapsDomainDataLookupQEMU(const void *data ATTRIBUTE_UNUSED)
virObjectUnref(caps);
return ret;
}
#endif /* WITH_QEMU */
#ifdef WITH_XEN
static int
test_virCapsDomainDataLookupXen(const void *data ATTRIBUTE_UNUSED)
{
......@@ -288,7 +291,9 @@ test_virCapsDomainDataLookupXen(const void *data ATTRIBUTE_UNUSED)
virObjectUnref(caps);
return ret;
}
#endif /* WITH_XEN */
#ifdef WITH_LXC
static int
test_virCapsDomainDataLookupLXC(const void *data ATTRIBUTE_UNUSED)
{
......@@ -311,6 +316,7 @@ test_virCapsDomainDataLookupLXC(const void *data ATTRIBUTE_UNUSED)
virObjectUnref(caps);
return ret;
}
#endif /* WITH_LXC */
static int
mymain(void)
......@@ -320,15 +326,21 @@ mymain(void)
if (virtTestRun("virCapabilitiesGetCpusForNodemask",
test_virCapabilitiesGetCpusForNodemask, NULL) < 0)
ret = -1;
#ifdef WITH_QEMU
if (virtTestRun("virCapsDomainDataLookupQEMU",
test_virCapsDomainDataLookupQEMU, NULL) < 0)
ret = -1;
#endif
#ifdef WITH_XEN
if (virtTestRun("virCapsDomainDataLookupXen",
test_virCapsDomainDataLookupXen, NULL) < 0)
ret = -1;
#endif
#ifdef WITH_LXC
if (virtTestRun("virCapsDomainDataLookupLXC",
test_virCapsDomainDataLookupLXC, NULL) < 0)
ret = -1;
#endif /* WITH_LXC */
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册