Build: Fix test forks and memory calculations for low memory cases
This commit is contained in:
@@ -183,7 +183,7 @@ fun Project.projectTest(
|
||||
project.kotlinBuildProperties.junit5NumberOfThreadsForParallelExecution ?: Runtime.getRuntime().availableProcessors()
|
||||
|
||||
val memoryPerTestProcessMb = maxHeapSizeMb ?: if (jUnitMode == JUnitMode.JUnit5)
|
||||
totalMaxMemoryForTestsMb.coerceAtMost(defaultMaxMemoryPerTestWorkerMb * junit5ParallelTestWorkers)
|
||||
totalMaxMemoryForTestsMb.coerceIn(defaultMaxMemoryPerTestWorkerMb, defaultMaxMemoryPerTestWorkerMb * junit5ParallelTestWorkers)
|
||||
else
|
||||
defaultMaxMemoryPerTestWorkerMb
|
||||
|
||||
@@ -243,7 +243,7 @@ fun Project.projectTest(
|
||||
val forks = (totalMaxMemoryForTestsMb / memoryPerTestProcessMb).coerceAtMost(16)
|
||||
maxParallelForks =
|
||||
project.providers.gradleProperty("kotlin.test.maxParallelForks").forUseAtConfigurationTime().orNull?.toInt()
|
||||
?: forks.coerceAtMost(Runtime.getRuntime().availableProcessors())
|
||||
?: forks.coerceIn(1, Runtime.getRuntime().availableProcessors())
|
||||
}
|
||||
}.apply { configure(body) }
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ if (isTeamcityBuild) {
|
||||
val KGP_TEST_TASKS_GROUP = "Kotlin Gradle Plugin Verification"
|
||||
val memoryPerGradleTestWorkerMb = 6000
|
||||
val maxParallelTestForks =
|
||||
(totalMaxMemoryForTestsMb / memoryPerGradleTestWorkerMb).coerceAtMost(Runtime.getRuntime().availableProcessors())
|
||||
(totalMaxMemoryForTestsMb / memoryPerGradleTestWorkerMb).coerceIn(1, Runtime.getRuntime().availableProcessors())
|
||||
|
||||
val allParallelTestsTask = tasks.register<Test>("kgpAllParallelTests") {
|
||||
group = KGP_TEST_TASKS_GROUP
|
||||
|
||||
Reference in New Issue
Block a user