[Test] Allow facades to return null which indicates that facade can't complete it's job
This is needed for cases when test pipeline assumes that some part of pipeline may be unavailable because of errors on previous stage. For example, this may occur in some test which check something on IR but contains backend facade for compiling binary dependencies. In this case testdata with frontend errors is allowed if test has only one module which should not be compiled
This commit is contained in:
committed by
TeamCityServer
parent
6a7cd0c811
commit
acb6d2e196
@@ -98,7 +98,7 @@ class TestRunner(private val testConfiguration: TestConfiguration) {
|
||||
if (!frontendKind.shouldRunAnalysis) return
|
||||
|
||||
val frontendArtifacts: ResultingArtifact.FrontendOutput<*> = testConfiguration.getFacade(SourcesKind, frontendKind)
|
||||
.transform(module, sourcesArtifact).also { dependencyProvider.registerArtifact(module, it) }
|
||||
.transform(module, sourcesArtifact)?.also { dependencyProvider.registerArtifact(module, it) } ?: return
|
||||
val frontendHandlers: List<AnalysisHandler<*>> = testConfiguration.getHandlers(frontendKind)
|
||||
for (frontendHandler in frontendHandlers) {
|
||||
withAssertionCatching {
|
||||
@@ -110,7 +110,7 @@ class TestRunner(private val testConfiguration: TestConfiguration) {
|
||||
if (!backendKind.shouldRunAnalysis) return
|
||||
|
||||
val backendInputInfo = testConfiguration.getFacade(frontendKind, backendKind)
|
||||
.hackyTransform(module, frontendArtifacts).also { dependencyProvider.registerArtifact(module, it) }
|
||||
.hackyTransform(module, frontendArtifacts)?.also { dependencyProvider.registerArtifact(module, it) } ?: return
|
||||
|
||||
val backendHandlers: List<AnalysisHandler<*>> = testConfiguration.getHandlers(backendKind)
|
||||
for (backendHandler in backendHandlers) {
|
||||
@@ -120,9 +120,9 @@ class TestRunner(private val testConfiguration: TestConfiguration) {
|
||||
for (artifactKind in moduleStructure.getTargetArtifactKinds(module)) {
|
||||
if (!artifactKind.shouldRunAnalysis) continue
|
||||
val binaryArtifact = testConfiguration.getFacade(backendKind, artifactKind)
|
||||
.hackyTransform(module, backendInputInfo).also {
|
||||
.hackyTransform(module, backendInputInfo)?.also {
|
||||
dependencyProvider.registerArtifact(module, it)
|
||||
}
|
||||
} ?: return
|
||||
|
||||
val binaryHandlers: List<AnalysisHandler<*>> = testConfiguration.getHandlers(artifactKind)
|
||||
for (binaryHandler in binaryHandlers) {
|
||||
@@ -167,7 +167,7 @@ private fun <A : ResultingArtifact<A>> AnalysisHandler<A>.processModule(module:
|
||||
private fun AbstractTestFacade<*, *>.hackyTransform(
|
||||
module: TestModule,
|
||||
artifact: ResultingArtifact<*>
|
||||
): ResultingArtifact<*> {
|
||||
): ResultingArtifact<*>? {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return (this as AbstractTestFacade<ResultingArtifact.Source, ResultingArtifact.Source>)
|
||||
.transform(module, artifact as ResultingArtifact<ResultingArtifact.Source>)
|
||||
@@ -176,7 +176,7 @@ private fun AbstractTestFacade<*, *>.hackyTransform(
|
||||
private fun <I : ResultingArtifact<I>, O : ResultingArtifact<O>> AbstractTestFacade<I, O>.transform(
|
||||
module: TestModule,
|
||||
inputArtifact: ResultingArtifact<I>
|
||||
): O {
|
||||
): O? {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return transform(module, inputArtifact as I)
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ abstract class AbstractTestFacade<I : ResultingArtifact<I>, O : ResultingArtifac
|
||||
abstract val inputKind: TestArtifactKind<I>
|
||||
abstract val outputKind: TestArtifactKind<O>
|
||||
|
||||
abstract fun transform(module: TestModule, inputArtifact: I): O
|
||||
abstract fun transform(module: TestModule, inputArtifact: I): O?
|
||||
|
||||
open val additionalServices: List<ServiceRegistrationData>
|
||||
get() = emptyList()
|
||||
|
||||
Reference in New Issue
Block a user