@@ -3,11 +3,13 @@ package org.jetbrains.plugins.scala.compiler
33import com .intellij .debugger .impl .OutputChecker
44import com .intellij .execution .ExecutionTestCase
55import com .intellij .execution .configurations .JavaParameters
6+ import com .intellij .openapi .application .ApplicationManager
67import com .intellij .openapi .diagnostic .Logger
78import com .intellij .openapi .projectRoots .Sdk
89import com .intellij .openapi .vfs .LocalFileSystem
910import com .intellij .pom .java .LanguageLevel
1011import com .intellij .testFramework .EdtTestUtil
12+ import com .intellij .testFramework .common .ThreadLeakTracker
1113import org .jetbrains .plugins .scala .base .libraryLoaders .{HeavyJDKLoader , LibraryLoader , ScalaSDKLoader , SmartJDKLoader }
1214import org .jetbrains .plugins .scala .base .{ScalaSdkOwner , SourceRootTestUtil }
1315import org .jetbrains .plugins .scala .extensions .PathExt
@@ -74,6 +76,8 @@ trait ScalaExecutionTestCase extends ExecutionTestCase with ScalaSdkOwner {
7476
7577 override protected def getTestProjectJdk : Sdk = SmartJDKLoader .getOrCreateJDK(testProjectJdkVersion)
7678
79+ protected def reuseCompileServerProcessBetweenTests : Boolean = true
80+
7781 override protected def setUpModule (): Unit = {
7882 super .setUpModule()
7983 EdtTestUtil .runInEdtAndWait { () =>
@@ -104,7 +108,17 @@ trait ScalaExecutionTestCase extends ExecutionTestCase with ScalaSdkOwner {
104108
105109 override protected def tearDown (): Unit = {
106110 try {
107- CompileServerLauncher .stopServerAndWait()
111+ if (reuseCompileServerProcessBetweenTests) {
112+ // noinspection ApiStatus,UnstableApiUsage
113+ ThreadLeakTracker .longRunningThreadCreated(
114+ ApplicationManager .getApplication,
115+ " BaseDataReader: output stream of scalaCompileServer" ,
116+ " BaseDataReader: error stream of scalaCompileServer" ,
117+ " scalaCompileServer"
118+ )
119+ } else {
120+ CompileServerLauncher .stopServerAndWait()
121+ }
108122 EdtTestUtil .runInEdtAndWait { () =>
109123 disposeLibraries(getModule)
110124 }
0 commit comments