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.
This commit is contained in:
Edward Thomson 2016-11-18 16:50:34 +00:00
parent 82f15896de
commit 99479062db

View File

@ -39,14 +39,14 @@ void test_core_init__concurrent_init_succeeds(void)
git_thread threads[10]; git_thread threads[10];
unsigned i; 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++) for (i = 0; i < ARRAY_SIZE(threads); i++)
git_thread_create(&threads[i], reinit, NULL); git_thread_create(&threads[i], reinit, NULL);
for (i = 0; i < ARRAY_SIZE(threads); i++) for (i = 0; i < ARRAY_SIZE(threads); i++)
git_thread_join(&threads[i], NULL); 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(); cl_sandbox_set_search_path_defaults();
#else #else
cl_skip(); cl_skip();