]>
Commit | Line | Data |
---|---|---|
156cfec0 | 1 | #include "clar_libgit2.h" |
6b5c0886 | 2 | #include "clar_libgit2_trace.h" |
156cfec0 | 3 | |
c25aa7cd PP |
4 | #ifdef GIT_WIN32_LEAKCHECK |
5 | # include "win32/w32_leakcheck.h" | |
6 | #endif | |
7 | ||
73b58c91 | 8 | #ifdef _WIN32 |
1d5d4186 | 9 | int __cdecl main(int argc, char *argv[]) |
73b58c91 | 10 | #else |
1d5d4186 | 11 | int main(int argc, char *argv[]) |
73b58c91 | 12 | #endif |
156cfec0 VM |
13 | { |
14 | int res; | |
ac3d33df | 15 | char *at_exit_cmd; |
156cfec0 | 16 | |
e0d61c7b ET |
17 | clar_test_init(argc, argv); |
18 | ||
eae0bfdc PP |
19 | res = git_libgit2_init(); |
20 | if (res < 0) { | |
c25aa7cd PP |
21 | const git_error *err = git_error_last(); |
22 | const char *msg = err ? err->message : "unknown failure"; | |
23 | fprintf(stderr, "failed to init libgit2: %s\n", msg); | |
eae0bfdc PP |
24 | return res; |
25 | } | |
26 | ||
6b5c0886 | 27 | cl_global_trace_register(); |
8487e237 | 28 | cl_sandbox_set_search_path_defaults(); |
e579e0f7 | 29 | cl_sandbox_disable_ownership_validation(); |
e0d61c7b | 30 | |
156cfec0 | 31 | /* Run the test suite */ |
e0d61c7b ET |
32 | res = clar_test_run(); |
33 | ||
34 | clar_test_shutdown(); | |
156cfec0 | 35 | |
6b5c0886 | 36 | cl_global_trace_disable(); |
799e22ea | 37 | git_libgit2_shutdown(); |
156cfec0 | 38 | |
c25aa7cd PP |
39 | #ifdef GIT_WIN32_LEAKCHECK |
40 | if (git_win32_leakcheck_has_leaks()) | |
41 | res = res || 1; | |
42 | #endif | |
43 | ||
ac3d33df JK |
44 | at_exit_cmd = getenv("CLAR_AT_EXIT"); |
45 | if (at_exit_cmd != NULL) { | |
46 | int at_exit = system(at_exit_cmd); | |
47 | return res || at_exit; | |
48 | } | |
49 | ||
156cfec0 VM |
50 | return res; |
51 | } |