提交 70bc623b 编写于 作者: M Michal Privoznik

viralloc: Export virAllocTest*

If users build with --enable-test-oom configure option,
they get this error saying, virAllocTest* functions are
not defined within tests/testutils.c.
上级 c5f28d01
...@@ -993,6 +993,10 @@ virSecurityManagerVerify; ...@@ -993,6 +993,10 @@ virSecurityManagerVerify;
# util/viralloc.h # util/viralloc.h
virAlloc; virAlloc;
virAllocN; virAllocN;
virAllocTestCount;
virAllocTestHook;
virAllocTestInit;
virAllocTestOOM;
virAllocVar; virAllocVar;
virDeleteElementsN; virDeleteElementsN;
virExpandN; virExpandN;
......
...@@ -74,6 +74,30 @@ static int virAllocTestFail(void) ...@@ -74,6 +74,30 @@ static int virAllocTestFail(void)
testMallocNext++; testMallocNext++;
return fail; 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 #endif
......
...@@ -376,15 +376,8 @@ void virFree(void *ptrptr) ATTRIBUTE_NONNULL(1); ...@@ -376,15 +376,8 @@ void virFree(void *ptrptr) ATTRIBUTE_NONNULL(1);
# define VIR_FREE(ptr) virFree((void *) &(ptr)) # define VIR_FREE(ptr) virFree((void *) &(ptr))
# endif # endif
# if TEST_OOM
void virAllocTestInit(void); void virAllocTestInit(void);
int virAllocTestCount(void); int virAllocTestCount(void);
void virAllocTestOOM(int n, int m); void virAllocTestOOM(int n, int m);
void virAllocTestHook(void (*func)(int, void*), void *data); void virAllocTestHook(void (*func)(int, void*), void *data);
# endif
#endif /* __VIR_MEMORY_H_ */ #endif /* __VIR_MEMORY_H_ */
...@@ -697,7 +697,7 @@ int virtTestMain(int argc, ...@@ -697,7 +697,7 @@ int virtTestMain(int argc,
if (worker) { if (worker) {
_exit(ret); _exit(ret);
} else { } else {
int i, status; int i;
for (i = 0 ; i < mp ; i++) { for (i = 0 ; i < mp ; i++) {
if (virProcessWait(workers[i], NULL) < 0) if (virProcessWait(workers[i], NULL) < 0)
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册