Commit a6fb72a8 by Edward Thomson

tests: exit with error on win32 leakcheck

parent b5dcdad3
...@@ -558,6 +558,11 @@ static void git_win32_leakcheck_global_shutdown(void) ...@@ -558,6 +558,11 @@ static void git_win32_leakcheck_global_shutdown(void)
git_win32_leakcheck_stack_cleanup(); git_win32_leakcheck_stack_cleanup();
} }
bool git_win32_leakcheck_has_leaks(void)
{
return (g_transient_count_total_leaks > 0);
}
int git_win32_leakcheck_global_init(void) int git_win32_leakcheck_global_init(void)
{ {
git_win32_leakcheck_stacktrace_init(); git_win32_leakcheck_stacktrace_init();
......
...@@ -21,6 +21,8 @@ int git_win32_leakcheck_global_init(void); ...@@ -21,6 +21,8 @@ int git_win32_leakcheck_global_init(void);
#include "git2/errors.h" #include "git2/errors.h"
#include "strnlen.h" #include "strnlen.h"
bool git_win32_leakcheck_has_leaks(void);
/* Stack frames (for stack tracing, below) */ /* Stack frames (for stack tracing, below) */
/** /**
......
#include "clar_libgit2.h" #include "clar_libgit2.h"
#include "clar_libgit2_trace.h" #include "clar_libgit2_trace.h"
#ifdef GIT_WIN32_LEAKCHECK
# include "win32/w32_leakcheck.h"
#endif
#ifdef _WIN32 #ifdef _WIN32
int __cdecl main(int argc, char *argv[]) int __cdecl main(int argc, char *argv[])
#else #else
...@@ -29,6 +33,11 @@ int main(int argc, char *argv[]) ...@@ -29,6 +33,11 @@ int main(int argc, char *argv[])
cl_global_trace_disable(); cl_global_trace_disable();
git_libgit2_shutdown(); git_libgit2_shutdown();
#ifdef GIT_WIN32_LEAKCHECK
if (git_win32_leakcheck_has_leaks())
res = res || 1;
#endif
at_exit_cmd = getenv("CLAR_AT_EXIT"); at_exit_cmd = getenv("CLAR_AT_EXIT");
if (at_exit_cmd != NULL) { if (at_exit_cmd != NULL) {
int at_exit = system(at_exit_cmd); int at_exit = system(at_exit_cmd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment