FIR IDE: add ability to run multimodule tests
This commit is contained in:
committed by
teamcityserver
parent
1cb34541bd
commit
a9bb577154
@@ -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) {
|
||||
|
||||
+10
@@ -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)
|
||||
}
|
||||
+6
@@ -28,6 +28,7 @@ class TestConfigurationBuilder {
|
||||
private val sourcePreprocessors: MutableList<Constructor<SourceFilePreprocessor>> = mutableListOf()
|
||||
private val additionalMetaInfoProcessors: MutableList<Constructor<AdditionalMetaInfoProcessor>> = mutableListOf()
|
||||
private val environmentConfigurators: MutableList<Constructor<EnvironmentConfigurator>> = mutableListOf()
|
||||
private val preAnalysisHandlers: MutableList<Constructor<PreAnalysisHandler>> = mutableListOf()
|
||||
|
||||
private val additionalSourceProviders: MutableList<Constructor<AdditionalSourceProvider>> = mutableListOf()
|
||||
private val moduleStructureTransformers: MutableList<ModuleStructureTransformer> = mutableListOf()
|
||||
@@ -131,6 +132,10 @@ class TestConfigurationBuilder {
|
||||
this.environmentConfigurators += environmentConfigurators
|
||||
}
|
||||
|
||||
fun usePreAnalysisHandlers(vararg handlers: Constructor<PreAnalysisHandler>) {
|
||||
this.preAnalysisHandlers += handlers
|
||||
}
|
||||
|
||||
fun useMetaInfoProcessors(vararg updaters: Constructor<AdditionalMetaInfoProcessor>) {
|
||||
additionalMetaInfoProcessors += updaters
|
||||
}
|
||||
@@ -189,6 +194,7 @@ class TestConfigurationBuilder {
|
||||
additionalMetaInfoProcessors,
|
||||
environmentConfigurators,
|
||||
additionalSourceProviders,
|
||||
preAnalysisHandlers,
|
||||
moduleStructureTransformers,
|
||||
metaTestConfigurators,
|
||||
afterAnalysisCheckers,
|
||||
|
||||
+4
@@ -33,6 +33,7 @@ class TestConfigurationImpl(
|
||||
environmentConfigurators: List<Constructor<EnvironmentConfigurator>>,
|
||||
|
||||
additionalSourceProviders: List<Constructor<AdditionalSourceProvider>>,
|
||||
preAnalysisHandlers: List<Constructor<PreAnalysisHandler>>,
|
||||
moduleStructureTransformers: List<ModuleStructureTransformer>,
|
||||
metaTestConfigurators: List<Constructor<MetaTestConfigurator>>,
|
||||
afterAnalysisCheckers: List<Constructor<AfterAnalysisChecker>>,
|
||||
@@ -70,6 +71,9 @@ class TestConfigurationImpl(
|
||||
}
|
||||
}
|
||||
|
||||
override val preAnalysisHandlers: List<PreAnalysisHandler> =
|
||||
preAnalysisHandlers.map { it.invoke(testServices) }
|
||||
|
||||
override val moduleStructureExtractor: ModuleStructureExtractor = ModuleStructureExtractorImpl(
|
||||
testServices,
|
||||
additionalSourceProviders.map { it.invoke(testServices) }.also {
|
||||
|
||||
Reference in New Issue
Block a user