[Test] Parallelize test generation

This commit is contained in:
Kirill Rakhman
2023-08-25 16:14:27 +02:00
committed by Space Team
parent 0d04e170b1
commit bb8a46c3a0
12 changed files with 72 additions and 43 deletions
@@ -7,24 +7,24 @@ package org.jetbrains.kotlin.project.model.infra.generate
import org.jetbrains.kotlin.generators.*
import org.jetbrains.kotlin.generators.model.*
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil
import org.jetbrains.kotlin.project.model.infra.KpmCoreCasesTestRunner
import java.io.File
fun generateKpmTestCases(
dryRun: Boolean = false,
init: TestGroupSuite.() -> Unit
init: TestGroupSuite.() -> Unit,
) {
val suite = TestGroupSuite(DefaultTargetBackendComputer).apply {
init()
}
for (testGroup in suite.testGroups) {
for (testClass in testGroup.testClasses) {
val (changed, testSourceFilePath) = NewTestGeneratorImpl(
listOf(KpmCoreCaseTestMethodGenerator)
).generateAndSave(testClass, dryRun)
if (changed) {
InconsistencyChecker.inconsistencyChecker(dryRun).add(testSourceFilePath)
}
val mainClassName = TestGeneratorUtil.getMainClassName()
suite.forEachTestClassParallel { testClass ->
val (changed, testSourceFilePath) = NewTestGeneratorImpl(
listOf(KpmCoreCaseTestMethodGenerator)
).generateAndSave(testClass, dryRun, mainClassName)
if (changed) {
InconsistencyChecker.inconsistencyChecker(dryRun).add(testSourceFilePath)
}
}
}