Skip to content

Commit 9947906

Browse files
author
Edward Thomson
committed
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 parent 82f1589 commit 9947906

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/core/init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ void test_core_init__concurrent_init_succeeds(void)
3939
git_thread threads[10];
4040
unsigned i;
4141

42-
cl_assert_equal_i(0, git_libgit2_shutdown());
42+
cl_assert_equal_i(2, git_libgit2_init());
4343

4444
for (i = 0; i < ARRAY_SIZE(threads); i++)
4545
git_thread_create(&threads[i], reinit, NULL);
4646
for (i = 0; i < ARRAY_SIZE(threads); i++)
4747
git_thread_join(&threads[i], NULL);
4848

49-
cl_assert_equal_i(1, git_libgit2_init());
49+
cl_assert_equal_i(1, git_libgit2_shutdown());
5050
cl_sandbox_set_search_path_defaults();
5151
#else
5252
cl_skip();

0 commit comments

Comments
 (0)