main.c 676 Bytes
Newer Older
1
#include "clar_libgit2.h"
2
#include "clar_libgit2_trace.h"
3

4
#ifdef _WIN32
Vicent Marti committed
5
int __cdecl main(int argc, char *argv[])
6
#else
Vicent Marti committed
7
int main(int argc, char *argv[])
8
#endif
9 10
{
	int res;
11
	char *at_exit_cmd;
12

13 14
	clar_test_init(argc, argv);

15 16 17 18 19 20
	res = git_libgit2_init();
	if (res < 0) {
		fprintf(stderr, "failed to init libgit2");
		return res;
	}

21
	cl_global_trace_register();
22
	cl_sandbox_set_search_path_defaults();
23

24
	/* Run the test suite */
25 26 27
	res = clar_test_run();

	clar_test_shutdown();
28

29
	cl_global_trace_disable();
30
	git_libgit2_shutdown();
31

32 33 34 35 36 37
	at_exit_cmd = getenv("CLAR_AT_EXIT");
	if (at_exit_cmd != NULL) {
		int at_exit = system(at_exit_cmd);
		return res || at_exit;
	}

38 39
	return res;
}