Skip to content

Commit eaa70c6

Browse files
committed
tests: object: decrease number of concurrent cache accesses
In our test case object::cache::fast_thread_rush, we're creating 100 concurrent threads opening a repository and reading objects from it. This test actually fails on ARM32 with an out-of-memory error, which isn't entirely unexpected. Work around the issue by halving the number of threads.
1 parent 01a8340 commit eaa70c6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/object/cache.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,15 @@ static void *cache_quick(void *arg)
244244

245245
void test_object_cache__fast_thread_rush(void)
246246
{
247-
int try, th, data[THREADCOUNT*2];
247+
int try, th, data[THREADCOUNT];
248248
#ifdef GIT_THREADS
249-
git_thread t[THREADCOUNT*2];
249+
git_thread t[THREADCOUNT];
250250
#endif
251251

252252
for (try = 0; try < REPEAT; ++try) {
253253
cl_git_pass(git_repository_open(&g_repo, cl_fixture("testrepo.git")));
254254

255-
for (th = 0; th < THREADCOUNT*2; ++th) {
255+
for (th = 0; th < THREADCOUNT; ++th) {
256256
data[th] = th;
257257
#ifdef GIT_THREADS
258258
cl_git_pass(
@@ -263,7 +263,7 @@ void test_object_cache__fast_thread_rush(void)
263263
}
264264

265265
#ifdef GIT_THREADS
266-
for (th = 0; th < THREADCOUNT*2; ++th) {
266+
for (th = 0; th < THREADCOUNT; ++th) {
267267
void *rval;
268268
cl_git_pass(git_thread_join(&t[th], &rval));
269269
cl_assert_equal_i(th, *((int *)rval));

0 commit comments

Comments
 (0)