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