From e6e69a4d8a995b1ba6ff056574d555391a984d09 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 30 Mar 2017 08:07:26 +0200 Subject: [PATCH] ConcurrentIndexTest: don't hang on computers with odd core count --- .../testSrc/com/intellij/index/ConcurrentIndexTest.groovy | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/index/ConcurrentIndexTest.groovy b/java/java-tests/testSrc/com/intellij/index/ConcurrentIndexTest.groovy index 153ff488864b..3a7b4b9c2cbe 100644 --- a/java/java-tests/testSrc/com/intellij/index/ConcurrentIndexTest.groovy +++ b/java/java-tests/testSrc/com/intellij/index/ConcurrentIndexTest.groovy @@ -57,7 +57,7 @@ class ConcurrentIndexTest extends JavaCodeInsightFixtureTestCase { def futuresToWait = [] def sameStartCondition = new CountDownLatch(N) - for(i in 1..N/2) { + for(i in 1.. N/2) { futuresToWait.add(ApplicationManager.application.executeOnPooledThread { sameStartCondition.countDown() sameStartCondition.await() @@ -153,7 +153,8 @@ class ConcurrentIndexTest extends JavaCodeInsightFixtureTestCase { def futuresToWait = [] def sameStartCondition = new CountDownLatch(N) - for(j in 1..N/2) { + def halfN = N / 2 + for(j in 1..halfN) { futuresToWait.add(ApplicationManager.application.executeOnPooledThread { ApplicationManager.application.runReadAction { sameStartCondition.countDown() @@ -163,7 +164,7 @@ class ConcurrentIndexTest extends JavaCodeInsightFixtureTestCase { }) } - for(j in 1..N/2) { + for(j in 1..(N - halfN)) { futuresToWait.add(ApplicationManager.application.executeOnPooledThread { ApplicationManager.application.runReadAction { sameStartCondition.countDown()