[Test] Disable gradle test parallelization if JUnit 5 is enabled

This commit is contained in:
Dmitriy Novozhilov
2021-02-25 10:37:43 +03:00
parent 2a7a20dd99
commit a9c6c115be
4 changed files with 8 additions and 4 deletions
+5 -1
View File
@@ -70,6 +70,10 @@ fun Task.dependsOnKotlinGradlePluginPublish() {
} }
} }
/**
* @param parallel is redundant if @param jUnit5Enabled is true, because
* JUnit5 supports parallel test execution by itself, without gradle help
*/
fun Project.projectTest( fun Project.projectTest(
taskName: String = "test", taskName: String = "test",
parallel: Boolean = false, parallel: Boolean = false,
@@ -193,7 +197,7 @@ fun Project.projectTest(
} }
} }
if (parallel) { if (parallel && !jUnit5Enabled) {
maxParallelForks = maxParallelForks =
project.findProperty("kotlin.test.maxParallelForks")?.toString()?.toInt() project.findProperty("kotlin.test.maxParallelForks")?.toString()?.toInt()
?: (Runtime.getRuntime().availableProcessors() / if (kotlinBuildProperties.isTeamcityBuild) 2 else 4).coerceAtLeast(1) ?: (Runtime.getRuntime().availableProcessors() / if (kotlinBuildProperties.isTeamcityBuild) 2 else 4).coerceAtLeast(1)
+1 -1
View File
@@ -78,7 +78,7 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
} }
} }
projectTest(parallel = true, jUnit5Enabled = true) { projectTest(jUnit5Enabled = true) {
dependsOn(":dist") dependsOn(":dist")
workingDir = rootDir workingDir = rootDir
jvmArgs!!.removeIf { it.contains("-Xmx") } jvmArgs!!.removeIf { it.contains("-Xmx") }
+1 -1
View File
@@ -58,7 +58,7 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
} }
} }
projectTest(parallel = true, jUnit5Enabled = true) { projectTest(jUnit5Enabled = true) {
workingDir = rootDir workingDir = rootDir
useJUnitPlatform() useJUnitPlatform()
} }
+1 -1
View File
@@ -69,7 +69,7 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
} }
} }
projectTest(parallel = true, jUnit5Enabled = true) { projectTest(jUnit5Enabled = true) {
dependsOn(":dist") dependsOn(":dist")
workingDir = rootDir workingDir = rootDir
jvmArgs!!.removeIf { it.contains("-Xmx") } jvmArgs!!.removeIf { it.contains("-Xmx") }