-Wed Jan 28 21:33:11 GMT 2009 Daniel P.Berrange <berrange@redhat.com
+Wed Jan 28 21:53:11 GMT 2009 Daniel P.Berrange <berrange@redhat.com>
+
+ Fix bogus valgrind memory leak warnings
+ * tests/testutils.c: Clear global error upon exit
+ * tests/.valgrind.supp: Ignore memory from thread local
+ error storage
+
+Wed Jan 28 21:33:11 GMT 2009 Daniel P.Berrange <berrange@redhat.com>
Fix RPC portability to Solaris
* configure.in: s/RPCGEN/HAVE_RPCGEN/ for automake
#include "internal.h"
#include "memory.h"
#include "util.h"
+#include "threads.h"
+#include "virterror_internal.h"
#if TEST_OOM_TRACE
#include <execinfo.h>
int (*func)(int, char **))
{
char *debugStr;
-#if TEST_OOM
int ret;
+#if TEST_OOM
int approxAlloc = 0;
int n;
char *oomStr = NULL;
int worker = 0;
#endif
+ if (virThreadInitialize() < 0 ||
+ virErrorInitialize() < 0)
+ return 1;
+
if ((debugStr = getenv("VIR_TEST_DEBUG")) != NULL) {
if (virStrToLong_ui(debugStr, NULL, 10, &testDebug) < 0)
testDebug = 0;
if (getenv("VIR_TEST_MP") != NULL) {
mp = sysconf(_SC_NPROCESSORS_ONLN);
fprintf(stderr, "Using %d worker processes\n", mp);
- if (VIR_ALLOC_N(workers, mp) < 0)
- return EXIT_FAILURE;
+ if (VIR_ALLOC_N(workers, mp) < 0) {
+ ret = EXIT_FAILURE;
+ goto cleanup;
+ }
}
if (testOOM)
/* Run once to count allocs, and ensure it passes :-) */
ret = (func)(argc, argv);
if (ret != EXIT_SUCCESS)
- return EXIT_FAILURE;
+ goto cleanup;
#if TEST_OOM_TRACE
if (testDebug)
else
fprintf(stderr, " FAILED\n");
}
- return ret;
-
+cleanup:
#else
- return (func)(argc, argv);
+ ret = (func)(argc, argv);
#endif
+
+ virResetLastError();
+ return ret;
}