diff --git a/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java b/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java index e3fa7774273a..6de2c3e6caf2 100644 --- a/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java +++ b/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java @@ -138,7 +138,7 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa @Override protected void tearDown() throws Exception { - ThreadTracker.awaitThreadTerminationWithParentParentGroup("JDI main", 100, TimeUnit.SECONDS); + ThreadTracker.awaitJDIThreadsTermination(100, TimeUnit.SECONDS); try { myDebugProcess = null; myPauseScriptListener = null; diff --git a/platform/testFramework/src/com/intellij/testFramework/ThreadTracker.java b/platform/testFramework/src/com/intellij/testFramework/ThreadTracker.java index b504be30843c..1a8fd1e81a42 100644 --- a/platform/testFramework/src/com/intellij/testFramework/ThreadTracker.java +++ b/platform/testFramework/src/com/intellij/testFramework/ThreadTracker.java @@ -180,7 +180,12 @@ public class ThreadTracker { return insideTPEGetTask; } - public static void awaitThreadTerminationWithParentParentGroup(@NotNull final String grandThreadGroup, int timeout, @NotNull TimeUnit unit) { + public static void awaitJDIThreadsTermination(int timeout, @NotNull TimeUnit unit) { + awaitThreadTerminationWithParentParentGroup("JDI main", timeout, unit); + } + private static void awaitThreadTerminationWithParentParentGroup(@NotNull final String grandThreadGroup, + int timeout, + @NotNull TimeUnit unit) { long start = System.currentTimeMillis(); while (System.currentTimeMillis() < start + unit.toMillis(timeout)) { Thread jdiThread = ContainerUtil.find(getThreads(), thread -> { diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyDebuggerTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyDebuggerTest.groovy index 8b978dc68b75..d4c9e3c68a20 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyDebuggerTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyDebuggerTest.groovy @@ -26,12 +26,15 @@ import com.intellij.psi.PsiFile import com.intellij.psi.search.GlobalSearchScope import com.intellij.testFramework.PsiTestUtil import com.intellij.testFramework.TestLoggerFactory +import com.intellij.testFramework.ThreadTracker import com.intellij.testFramework.builders.JavaModuleFixtureBuilder import com.intellij.testFramework.fixtures.impl.TempDirTestFixtureImpl import com.intellij.util.SystemProperties import groovy.transform.CompileStatic import org.jetbrains.plugins.groovy.GroovyFileType +import java.util.concurrent.TimeUnit + import static com.intellij.testFramework.EdtTestUtil.runInEdtAndWait /** @@ -51,6 +54,12 @@ class GroovyDebuggerTest extends GroovyCompilerTestCase implements DebuggerMetho enableDebugLogging() } + @Override + protected void tearDown() throws Exception { + ThreadTracker.awaitJDIThreadsTermination(100, TimeUnit.SECONDS); + super.tearDown() + } + @Override protected boolean runInDispatchThread() { return false