Skip to content

Commit a7bea1a

Browse files
demiurg906TeamCityServer
authored and
TeamCityServer
committed
[Build] Add ability to set fixed numbers of JUnit 5 threads via local.properties
1 parent 2fb066e commit a7bea1a

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

buildSrc/src/main/kotlin/BuildPropertiesExt.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,7 @@ val KotlinBuildProperties.isObsoleteJdkOverrideEnabled: Boolean
3535
get() = getBoolean("kotlin.build.isObsoleteJdkOverrideEnabled", false)
3636

3737
val KotlinBuildProperties.isNativeRuntimeDebugInfoEnabled: Boolean
38-
get() = getBoolean("kotlin.native.isNativeRuntimeDebugInfoEnabled", false)
38+
get() = getBoolean("kotlin.native.isNativeRuntimeDebugInfoEnabled", false)
39+
40+
val KotlinBuildProperties.junit5NumberOfThreadsForParallelExecution: Int?
41+
get() = (getOrNull("kotlin.test.junit5.maxParallelForks") as? String)?.toInt()

buildSrc/src/main/kotlin/tasks.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ fun Project.projectTest(
199199
systemProperty("jps.kotlin.home", project.rootProject.extra["distKotlinHomeDir"]!!)
200200
systemProperty("kotlin.ni", if (project.rootProject.hasProperty("newInferenceTests")) "true" else "false")
201201
systemProperty("org.jetbrains.kotlin.skip.muted.tests", if (project.rootProject.hasProperty("skipMutedTests")) "true" else "false")
202+
project.kotlinBuildProperties.junit5NumberOfThreadsForParallelExecution?.let { n ->
203+
systemProperty("junit.jupiter.execution.parallel.config.strategy", "fixed")
204+
systemProperty("junit.jupiter.execution.parallel.config.fixed.parallelism", n)
205+
}
202206

203207
systemProperty("idea.ignore.disabled.plugins", "true")
204208

@@ -319,4 +323,4 @@ abstract class PublishToMavenLocalSerializable : AbstractPublishToMaven() {
319323
}
320324
}.run()
321325
}
322-
}
326+
}

gradle.properties

+3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ org.gradle.vfs.watch=true
6767
# If it differs from default use next flag:
6868
#bootstrap.local.path=/path/to/repo
6969

70+
# Set number of threads which are used for running JUnit 5 tests in concurrent mode
71+
# If not set then min(number of CPU cores, 16) will be used
72+
#kotlin.test.junit5.maxParallelForks=4
7073

7174
# Those properties are used to automatically generate run configurations for modularized
7275
# and full pipeline tests for different sets of test data

0 commit comments

Comments
 (0)