clear fields after test run to avoid leaks when the test class instance stuck in queues

This commit is contained in:
Alexey Kudravtsev
2017-01-23 16:51:37 +03:00
parent 30a66a791d
commit 75fc3802fc
7 changed files with 35 additions and 1 deletions

View File

@@ -179,6 +179,15 @@ public class DirectoryIndexTest extends IdeaTestCase {
VirtualFileManager.getInstance().syncRefresh();
}
@Override
protected void tearDown() throws Exception {
myFileIndex = null;
myIndex = null;
myModule2 = null;
myModule3 = null;
super.tearDown();
}
private CompilerProjectExtension getCompilerProjectExtension() {
final CompilerProjectExtension instance = CompilerProjectExtension.getInstance(myProject);
assertNotNull(instance);

View File

@@ -140,6 +140,9 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa
protected void tearDown() throws Exception {
ThreadTracker.awaitThreadTerminationWithParentParentGroup("JDI main", 100, TimeUnit.SECONDS);
try {
myDebugProcess = null;
myPauseScriptListener = null;
myRatherLaterRequests.clear();
super.tearDown();
}
finally {
@@ -150,6 +153,7 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa
protected void throwExceptionsIfAny() {
synchronized (myException) {
CompoundRuntimeException.throwIfNotEmpty(myException);
myException.clear();
}
}

View File

@@ -132,7 +132,9 @@ public abstract class ExecutionTestCase extends IdeaTestCase {
protected void tearDown() throws Exception {
if (myCompilerTester != null) {
myCompilerTester.tearDown();
myCompilerTester = null;
}
myChecker = null;
EdtTestUtil.runInEdtAndWait(() -> super.tearDown());
//myChecker.checkValid(getTestProjectJdk());
//probably some thread is destroyed right now because of log exception

View File

@@ -83,6 +83,13 @@ public class VcsLogRefresherTest extends VcsPlatformTest {
}
}
finally {
myLogData = null;
myLoader = null;
myLogProvider = null;
myCommits = null;
myDataWaiter = null;
myStartedTasks.clear();
changeListManager = null;
super.tearDown();
}
}

View File

@@ -28,7 +28,6 @@ import com.intellij.xdebugger.impl.breakpoints.XBreakpointManagerImpl;
import org.jdom.Element;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
@@ -45,6 +44,12 @@ public abstract class XBreakpointsTestCase extends XDebuggerTestCase {
myTempFiles = new TempFiles(myFilesToDelete);
}
@Override
protected void tearDown() throws Exception {
myBreakpointManager = null;
super.tearDown();
}
protected void load(final Element element) {
XBreakpointManagerImpl.BreakpointManagerState managerState = XmlSerializer.deserialize(element, XBreakpointManagerImpl.BreakpointManagerState.class);
myBreakpointManager.loadState(managerState);

View File

@@ -35,6 +35,12 @@ public class XDependentBreakpointsTest extends XBreakpointsTestCase {
myDependentBreakpointManager = myBreakpointManager.getDependentBreakpointManager();
}
@Override
protected void tearDown() throws Exception {
myDependentBreakpointManager = null;
super.tearDown();
}
public void testDelete() throws Exception {
XLineBreakpoint<?> master = createMaster();
XLineBreakpoint<?> slave = createSlave();

View File

@@ -49,6 +49,7 @@ public abstract class TaskBranchesTest extends PlatformTestCase {
((ChangeListManagerImpl)ChangeListManager.getInstance(myProject)).waitEverythingDoneInTestMode();
}
finally {
myTaskManager = null;
super.tearDown();
}
}