If users build with --enable-test-oom configure option,
they get this error saying, virAllocTest* functions are
not defined within tests/testutils.c.
---
src/libvirt_private.syms | 4 ++++
src/util/viralloc.c | 24 ++++++++++++++++++++++++
src/util/viralloc.h | 7 -------
tests/testutils.c | 2 +-
4 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 9529265..f241ec4 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -993,6 +993,10 @@ virSecurityManagerVerify;
# util/viralloc.h
virAlloc;
virAllocN;
+virAllocTestCount;
+virAllocTestHook;
+virAllocTestInit;
+virAllocTestOOM;
virAllocVar;
virDeleteElementsN;
virExpandN;
diff --git a/src/util/viralloc.c b/src/util/viralloc.c
index 807de04..342b0eb 100644
--- a/src/util/viralloc.c
+++ b/src/util/viralloc.c
@@ -74,6 +74,30 @@ static int virAllocTestFail(void)
testMallocNext++;
return fail;
}
+
+#else
+
+void virAllocTestOOM(int n ATTRIBUTE_UNUSED,
+ int m ATTRIBUTE_UNUSED)
+{
+ /* nada */
+}
+
+int virAllocTestCount(void)
+{
+ return 0;
+}
+
+void virAllocTestInit(void)
+{
+ /* nada */
+}
+
+void virAllocTestHook(void (*func)(int, void*) ATTRIBUTE_UNUSED,
+ void *data ATTRIBUTE_UNUSED)
+{
+ /* nada */
+}
#endif
diff --git a/src/util/viralloc.h b/src/util/viralloc.h
index 6f46d0b..7be7f82 100644
--- a/src/util/viralloc.h
+++ b/src/util/viralloc.h
@@ -376,15 +376,8 @@ void virFree(void *ptrptr) ATTRIBUTE_NONNULL(1);
# define VIR_FREE(ptr) virFree((void *) &(ptr))
# endif
-
-
-# if TEST_OOM
void virAllocTestInit(void);
int virAllocTestCount(void);
void virAllocTestOOM(int n, int m);
void virAllocTestHook(void (*func)(int, void*), void *data);
-# endif
-
-
-
#endif /* __VIR_MEMORY_H_ */
diff --git a/tests/testutils.c b/tests/testutils.c
index ea46c09..0fb69ec 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -697,7 +697,7 @@ int virtTestMain(int argc,
if (worker) {
_exit(ret);
} else {
- int i, status;
+ int i;
for (i = 0 ; i < mp ; i++) {
if (virProcessWait(workers[i], NULL) < 0)
ret = EXIT_FAILURE;
--
1.8.1.5