Skip to content

Commit fab4c0a

Browse files
author
builduser
committed
Merged branch idea251.release into idea251.x
2 parents 8874130 + 6d01636 commit fab4c0a

File tree

3 files changed

+38
-10
lines changed

3 files changed

+38
-10
lines changed

scala/compiler-integration/test/org/jetbrains/plugins/scala/compiler/DisplayModuleNameTestBase.scala

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import org.junit.Assert.fail
66

77
abstract class DisplayModuleNameTestBase(separateProdAndTestSources: Boolean = false) extends SbtProjectCompilationTestBase(separateProdAndTestSources) {
88

9+
override protected def reuseCompileServerProcessBetweenTests: Boolean = false
10+
911
protected def runTest(expectedValue: Boolean): Unit = {
1012
importProject(false)
1113
val modules = ModuleManager.getInstance(myProject).getModules

scala/compiler-integration/test/org/jetbrains/plugins/scala/compiler/SbtProjectCompilationTestBase.scala

+21-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package org.jetbrains.plugins.scala.compiler
22

3+
import com.intellij.openapi.application.ApplicationManager
34
import com.intellij.openapi.externalSystem.model.ProjectSystemId
45
import com.intellij.openapi.module.Module
56
import com.intellij.openapi.projectRoots.{ProjectJdkTable, Sdk}
67
import com.intellij.openapi.roots.{CompilerModuleExtension, ModuleRootManager}
78
import com.intellij.openapi.vfs.VfsUtil
89
import com.intellij.platform.externalSystem.testFramework.ExternalSystemImportingTestCase
910
import com.intellij.testFramework.CompilerTester
11+
import com.intellij.testFramework.common.ThreadLeakTracker
1012
import org.jetbrains.annotations.Nullable
1113
import org.jetbrains.plugins.scala.base.libraryLoaders.SmartJDKLoader
1214
import org.jetbrains.plugins.scala.extensions.inWriteAction
@@ -50,6 +52,8 @@ abstract class SbtProjectCompilationTestBase(separateProdAndTestSources: Boolean
5052

5153
override def getTestsTempDir: String = this.getClass.getSimpleName
5254

55+
protected def reuseCompileServerProcessBetweenTests: Boolean = true
56+
5357
override def setUp(): Unit = {
5458
super.setUp()
5559

@@ -63,10 +67,26 @@ abstract class SbtProjectCompilationTestBase(separateProdAndTestSources: Boolean
6367
}
6468

6569
SbtCachesSetupUtil.setupCoursierAndIvyCache(getProject)
70+
71+
if (reuseCompileServerProcessBetweenTests) {
72+
//noinspection ApiStatus,UnstableApiUsage
73+
ThreadLeakTracker.longRunningThreadCreated(
74+
ApplicationManager.getApplication,
75+
"BaseDataReader: output stream of scalaCompileServer",
76+
"BaseDataReader: error stream of scalaCompileServer",
77+
"scalaCompileServer"
78+
)
79+
} else {
80+
// We don't want to reuse the compile server in this test class, but it may have already been started.
81+
// We should shut it down first.
82+
CompileServerLauncher.stopServerAndWait()
83+
}
6684
}
6785

6886
override def tearDown(): Unit = try {
69-
CompileServerLauncher.stopServerAndWait()
87+
if (!reuseCompileServerProcessBetweenTests) {
88+
CompileServerLauncher.stopServerAndWait()
89+
}
7090
compiler.tearDown()
7191
val settings = ScalaCompileServerSettings.getInstance()
7292
settings.USE_DEFAULT_SDK = true

scala/compiler-integration/test/org/jetbrains/plugins/scala/compiler/ScalaExecutionTestCase.scala

+15-9
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,27 @@ trait ScalaExecutionTestCase extends ExecutionTestCase with ScalaSdkOwner {
102102

103103
super.setUp()
104104

105+
if (reuseCompileServerProcessBetweenTests) {
106+
//noinspection ApiStatus,UnstableApiUsage
107+
ThreadLeakTracker.longRunningThreadCreated(
108+
ApplicationManager.getApplication,
109+
"BaseDataReader: output stream of scalaCompileServer",
110+
"BaseDataReader: error stream of scalaCompileServer",
111+
"scalaCompileServer"
112+
)
113+
} else {
114+
// We don't want to reuse the compile server in this test class, but it may have already been started.
115+
// We should shut it down first.
116+
CompileServerLauncher.stopServerAndWait()
117+
}
118+
105119
LocalFileSystem.getInstance().refreshIoFiles(srcPath.toFile.listFiles().toList.asJava)
106120
compileProject()
107121
}
108122

109123
override protected def tearDown(): Unit = {
110124
try {
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 {
125+
if (!reuseCompileServerProcessBetweenTests) {
120126
CompileServerLauncher.stopServerAndWait()
121127
}
122128
EdtTestUtil.runInEdtAndWait { () =>

0 commit comments

Comments
 (0)