main.c 1.05 KB
Newer Older
1 2 3 4 5 6 7

#if defined(GIT_MSVC_CRTDBG)
/* Enable MSVC CRTDBG memory leak reporting.  See src/util.h for details. */
#include <stdlib.h>
#include <crtdbg.h>
#endif

8
#include "clar_libgit2.h"
9
#include "clar_libgit2_trace.h"
10

11
#ifdef _WIN32
Vicent Marti committed
12
int __cdecl main(int argc, char *argv[])
13
#else
Vicent Marti committed
14
int main(int argc, char *argv[])
15
#endif
16 17 18
{
	int res;

19 20 21 22 23 24 25 26 27 28 29 30
#if defined(GIT_MSVC_CRTDBG)
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);

	_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
	_CrtSetReportMode(_CRT_ERROR,  _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
	_CrtSetReportMode(_CRT_WARN,   _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);

	_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
	_CrtSetReportFile(_CRT_ERROR,  _CRTDBG_FILE_STDERR);
	_CrtSetReportFile(_CRT_WARN,   _CRTDBG_FILE_STDERR);
#endif

31 32
	clar_test_init(argc, argv);

33
	git_libgit2_init();
34
	cl_global_trace_register();
35
	cl_sandbox_set_search_path_defaults();
36

37
	/* Run the test suite */
38 39 40
	res = clar_test_run();

	clar_test_shutdown();
41

42
	cl_global_trace_disable();
43
	git_libgit2_shutdown();
44 45 46

	return res;
}