FIR IDE: add ability to run multimodule tests

This commit is contained in:
Ilya Kirillov
2021-06-22 17:12:39 +02:00
committed by teamcityserver
parent 1cb34541bd
commit a9bb577154
12 changed files with 179 additions and 112 deletions
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.test.directives.model.RegisteredDirectives
import org.jetbrains.kotlin.test.model.*
import org.jetbrains.kotlin.test.services.MetaTestConfigurator
import org.jetbrains.kotlin.test.services.ModuleStructureExtractor
import org.jetbrains.kotlin.test.services.PreAnalysisHandler
import org.jetbrains.kotlin.test.services.TestServices
typealias Constructor<T> = (TestServices) -> T
@@ -26,6 +27,8 @@ abstract class TestConfiguration {
abstract val moduleStructureExtractor: ModuleStructureExtractor
abstract val preAnalysisHandlers: List<PreAnalysisHandler>
abstract val metaTestConfigurators: List<MetaTestConfigurator>
abstract val afterAnalysisCheckers: List<AfterAnalysisChecker>
@@ -52,6 +52,7 @@ class TestRunner(private val testConfiguration: TestConfiguration) {
throw exception
}
testConfiguration.metaTestConfigurators.forEach {
if (it.shouldSkipTest()) return
}
@@ -62,6 +63,11 @@ class TestRunner(private val testConfiguration: TestConfiguration) {
val modules = moduleStructure.modules
val dependencyProvider = DependencyProviderImpl(services, modules)
services.registerDependencyProvider(dependencyProvider)
testConfiguration.preAnalysisHandlers.forEach { preprocessor ->
preprocessor.preprocessModuleStructure(moduleStructure)
}
var failedException: WrappedException? = null
try {
for (module in modules) {
@@ -0,0 +1,10 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.test.services
abstract class PreAnalysisHandler(protected val testServices: TestServices) {
abstract fun preprocessModuleStructure(moduleStructure: TestModuleStructure)
}