Commit 99479062dbb738ebc5892e163b701680cea91980

Edward Thomson 2016-11-18T16:50:34

core::init tests: reverse init/shutdown We want a predictable number of initializations in our multithreaded init test, but we also want to make sure that we have _actually_ initialized `git_libgit2_init` before calling `git_thread_create` (since it now has a sanity check that `git_libgit2_init` has been called). Since `git_thread_create` is internal-only, keep this sanity check. Flip the invocation so that we `git_libgit2_init` before our thread tests and `git_libgit2_shutdown` again after.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/tests/core/init.c b/tests/core/init.c
index cd90b37..a8cbd93 100644
--- a/tests/core/init.c
+++ b/tests/core/init.c
@@ -39,14 +39,14 @@ void test_core_init__concurrent_init_succeeds(void)
 	git_thread threads[10];
 	unsigned i;
 
-	cl_assert_equal_i(0, git_libgit2_shutdown());
+	cl_assert_equal_i(2, git_libgit2_init());
 
 	for (i = 0; i < ARRAY_SIZE(threads); i++)
 		git_thread_create(&threads[i], reinit, NULL);
 	for (i = 0; i < ARRAY_SIZE(threads); i++)
 		git_thread_join(&threads[i], NULL);
 
-	cl_assert_equal_i(1, git_libgit2_init());
+	cl_assert_equal_i(1, git_libgit2_shutdown());
 	cl_sandbox_set_search_path_defaults();
 #else
 	cl_skip();