summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2020-02-18 18:09:11 +0100
committerPatrick Steinhardt <ps@pks.im>2020-02-18 18:09:11 +0100
commiteaa70c6c36d3a8061e6c3ec5f95cf137fe1222ab (patch)
tree5a08472835142c3814691467de827654bc1e9ca2
parent01a8340662749943f3917505dc8ca65006495bec (diff)
downloadlibgit2-eaa70c6c36d3a8061e6c3ec5f95cf137fe1222ab.tar.gz
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.
-rw-r--r--tests/object/cache.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/object/cache.c b/tests/object/cache.c
index 3ccc325e4..08bf03648 100644
--- a/tests/object/cache.c
+++ b/tests/object/cache.c
@@ -244,15 +244,15 @@ static void *cache_quick(void *arg)
void test_object_cache__fast_thread_rush(void)
{
- int try, th, data[THREADCOUNT*2];
+ int try, th, data[THREADCOUNT];
#ifdef GIT_THREADS
- git_thread t[THREADCOUNT*2];
+ git_thread t[THREADCOUNT];
#endif
for (try = 0; try < REPEAT; ++try) {
cl_git_pass(git_repository_open(&g_repo, cl_fixture("testrepo.git")));
- for (th = 0; th < THREADCOUNT*2; ++th) {
+ for (th = 0; th < THREADCOUNT; ++th) {
data[th] = th;
#ifdef GIT_THREADS
cl_git_pass(
@@ -263,7 +263,7 @@ void test_object_cache__fast_thread_rush(void)
}
#ifdef GIT_THREADS
- for (th = 0; th < THREADCOUNT*2; ++th) {
+ for (th = 0; th < THREADCOUNT; ++th) {
void *rval;
cl_git_pass(git_thread_join(&t[th], &rval));
cl_assert_equal_i(th, *((int *)rval));