Commit 99479062 by Edward Thomson

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.
parent 82f15896
...@@ -39,14 +39,14 @@ void test_core_init__concurrent_init_succeeds(void) ...@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment