Tests: remove IGNORE_BACKEND_K2_LIGHT_TREE directive
This is a partial revert of f47040696e. This directive is not used
anymore.
#KT-56757 Fixed
This commit is contained in:
committed by
Space Team
parent
e9ccc0329c
commit
5aa0000b3e
+12
-17
@@ -9,7 +9,7 @@ import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.jetbrains.kotlin.test.WrappedException
|
||||
import org.jetbrains.kotlin.test.bind
|
||||
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives
|
||||
import org.jetbrains.kotlin.test.directives.extractIgnoredDirectivesForTargetBackend
|
||||
import org.jetbrains.kotlin.test.directives.extractIgnoredDirectiveForTargetBackend
|
||||
import org.jetbrains.kotlin.test.directives.model.DirectivesContainer
|
||||
import org.jetbrains.kotlin.test.directives.model.ValueDirective
|
||||
import org.jetbrains.kotlin.test.model.AfterAnalysisChecker
|
||||
@@ -18,7 +18,7 @@ import org.jetbrains.kotlin.test.services.*
|
||||
|
||||
class BlackBoxCodegenSuppressor(
|
||||
testServices: TestServices,
|
||||
val customIgnoreDirective: ValueDirective<TargetBackend>? = null
|
||||
private val customIgnoreDirective: ValueDirective<TargetBackend>? = null
|
||||
) : AfterAnalysisChecker(testServices) {
|
||||
override val directiveContainers: List<DirectivesContainer>
|
||||
get() = listOf(CodegenTestDirectives)
|
||||
@@ -29,37 +29,32 @@ class BlackBoxCodegenSuppressor(
|
||||
override fun suppressIfNeeded(failedAssertions: List<WrappedException>): List<WrappedException> {
|
||||
val suppressionChecker = testServices.codegenSuppressionChecker
|
||||
val moduleStructure = testServices.moduleStructure
|
||||
val ignoreDirectives = suppressionChecker.extractIgnoreDirectives(moduleStructure.modules.first()) ?: return failedAssertions
|
||||
return suppressionChecker.processAllDirectives(ignoreDirectives) { ignoreDirective, suppressionResult ->
|
||||
val ignoreDirective = suppressionChecker.extractIgnoreDirective(moduleStructure.modules.first()) ?: return failedAssertions
|
||||
return suppressionChecker.processAllDirectives(listOf(ignoreDirective)) { directive, suppressionResult ->
|
||||
listOfNotNull(
|
||||
suppressionChecker.processMutedTest(
|
||||
failed = failedAssertions.isNotEmpty(),
|
||||
ignoreDirective,
|
||||
directive,
|
||||
suppressionResult,
|
||||
)?.wrap()
|
||||
)
|
||||
} ?: failedAssertions
|
||||
}
|
||||
|
||||
class SuppressionChecker(val testServices: TestServices, val customIgnoreDirective: ValueDirective<TargetBackend>?) : TestService {
|
||||
fun extractIgnoreDirectives(module: TestModule): List<ValueDirective<TargetBackend>>? {
|
||||
class SuppressionChecker(
|
||||
val testServices: TestServices,
|
||||
private val customIgnoreDirective: ValueDirective<TargetBackend>?
|
||||
) : TestService {
|
||||
fun extractIgnoreDirective(module: TestModule): ValueDirective<TargetBackend>? {
|
||||
val targetBackend = testServices.defaultsProvider.defaultTargetBackend ?: module.targetBackend ?: return null
|
||||
return extractIgnoredDirectivesForTargetBackend(module, targetBackend, customIgnoreDirective)
|
||||
return extractIgnoredDirectiveForTargetBackend(module, targetBackend, customIgnoreDirective)
|
||||
}
|
||||
|
||||
fun failuresInModuleAreIgnored(module: TestModule): Boolean {
|
||||
val ignoreDirective = extractIgnoreDirectives(module) ?: return false
|
||||
val ignoreDirective = extractIgnoreDirective(module) ?: return false
|
||||
return failuresInModuleAreIgnored(module, ignoreDirective).testMuted
|
||||
}
|
||||
|
||||
private fun failuresInModuleAreIgnored(module: TestModule, ignoreDirectives: List<ValueDirective<TargetBackend>>): SuppressionResult {
|
||||
for (ignoreDirective in ignoreDirectives) {
|
||||
val result = failuresInModuleAreIgnored(module, ignoreDirective)
|
||||
if (result.testMuted) return result
|
||||
}
|
||||
return SuppressionResult.NO_MUTE
|
||||
}
|
||||
|
||||
fun failuresInModuleAreIgnored(module: TestModule, ignoreDirective: ValueDirective<TargetBackend>): SuppressionResult {
|
||||
val ignoredBackends = module.directives[ignoreDirective]
|
||||
|
||||
|
||||
+17
-41
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.test.directives
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.phaser.AnyNamedPhase
|
||||
import org.jetbrains.kotlin.test.FirParser
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.jetbrains.kotlin.test.backend.TargetInliner
|
||||
import org.jetbrains.kotlin.test.backend.handlers.*
|
||||
@@ -15,7 +14,6 @@ import org.jetbrains.kotlin.test.directives.model.DirectiveApplicability.File
|
||||
import org.jetbrains.kotlin.test.directives.model.DirectiveApplicability.Global
|
||||
import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer
|
||||
import org.jetbrains.kotlin.test.directives.model.ValueDirective
|
||||
import org.jetbrains.kotlin.test.directives.model.singleOrZeroValue
|
||||
import org.jetbrains.kotlin.test.model.FrontendKinds
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
|
||||
@@ -35,11 +33,6 @@ object CodegenTestDirectives : SimpleDirectivesContainer() {
|
||||
applicability = Global
|
||||
)
|
||||
|
||||
val IGNORE_BACKEND_K2_LIGHT_TREE by enumDirective<TargetBackend>(
|
||||
description = "Ignore specific backend if test uses K2 frontend in Light tree mode",
|
||||
applicability = Global
|
||||
)
|
||||
|
||||
val IGNORE_BACKEND_MULTI_MODULE by enumDirective<TargetBackend>(
|
||||
description = "Ignore failures of multimodule test on target backend",
|
||||
applicability = Global
|
||||
@@ -251,43 +244,26 @@ object CodegenTestDirectives : SimpleDirectivesContainer() {
|
||||
)
|
||||
}
|
||||
|
||||
fun extractIgnoredDirectivesForTargetBackend(
|
||||
fun extractIgnoredDirectiveForTargetBackend(
|
||||
module: TestModule,
|
||||
targetBackend: TargetBackend,
|
||||
customIgnoreDirective: ValueDirective<TargetBackend>? = null
|
||||
): List<ValueDirective<TargetBackend>> {
|
||||
val specificIgnoreDirectives = when (module.frontendKind) {
|
||||
FrontendKinds.ClassicFrontend -> listOf(CodegenTestDirectives.IGNORE_BACKEND_K1)
|
||||
FrontendKinds.FIR -> listOfNotNull(
|
||||
CodegenTestDirectives.IGNORE_BACKEND_K2,
|
||||
CodegenTestDirectives.IGNORE_BACKEND_K2_LIGHT_TREE.takeIf {
|
||||
module.directives.singleOrZeroValue(FirDiagnosticsDirectives.FIR_PARSER) == FirParser.LightTree
|
||||
): ValueDirective<TargetBackend>? =
|
||||
when (module.frontendKind) {
|
||||
FrontendKinds.ClassicFrontend -> CodegenTestDirectives.IGNORE_BACKEND_K1
|
||||
FrontendKinds.FIR -> CodegenTestDirectives.IGNORE_BACKEND_K2
|
||||
else -> null
|
||||
}?.let { specificIgnoreDirective ->
|
||||
when {
|
||||
customIgnoreDirective != null -> customIgnoreDirective
|
||||
!module.directives.contains(specificIgnoreDirective) -> CodegenTestDirectives.IGNORE_BACKEND
|
||||
else -> {
|
||||
val inCommonIgnored = module.directives[CodegenTestDirectives.IGNORE_BACKEND].let { targetBackend in it || TargetBackend.ANY in it }
|
||||
val inSpecificIgnored = module.directives[specificIgnoreDirective].let { targetBackend in it || TargetBackend.ANY in it }
|
||||
if (inCommonIgnored && inSpecificIgnored) {
|
||||
throw AssertionError("Both, IGNORE_BACKEND and ${specificIgnoreDirective.name} contain target backend ${targetBackend.name}. Please remove one of them.")
|
||||
}
|
||||
if (inCommonIgnored) CodegenTestDirectives.IGNORE_BACKEND else specificIgnoreDirective
|
||||
}
|
||||
)
|
||||
else -> return emptyList()
|
||||
}
|
||||
val result = specificIgnoreDirectives.mapNotNull {
|
||||
extractIgnoredDirectiveForTargetBackendForSpecificIgnoreDirective(module, targetBackend, it, customIgnoreDirective)
|
||||
}
|
||||
return result.takeIf { it.isNotEmpty() } ?: listOf(CodegenTestDirectives.IGNORE_BACKEND)
|
||||
}
|
||||
|
||||
private fun extractIgnoredDirectiveForTargetBackendForSpecificIgnoreDirective(
|
||||
module: TestModule,
|
||||
targetBackend: TargetBackend,
|
||||
specificIgnoreDirective: ValueDirective<TargetBackend>,
|
||||
customIgnoreDirective: ValueDirective<TargetBackend>?
|
||||
): ValueDirective<TargetBackend>? {
|
||||
return when {
|
||||
customIgnoreDirective != null -> customIgnoreDirective
|
||||
!module.directives.contains(specificIgnoreDirective) -> null//CodegenTestDirectives.IGNORE_BACKEND
|
||||
else -> {
|
||||
val inCommonIgnored = module.directives[CodegenTestDirectives.IGNORE_BACKEND].let { targetBackend in it || TargetBackend.ANY in it }
|
||||
val inSpecificIgnored = module.directives[specificIgnoreDirective].let { targetBackend in it || TargetBackend.ANY in it }
|
||||
if (inCommonIgnored && inSpecificIgnored) {
|
||||
throw AssertionError("Both, IGNORE_BACKEND and ${specificIgnoreDirective.name} contain target backend ${targetBackend.name}. Please remove one of them.")
|
||||
}
|
||||
if (inCommonIgnored) null else specificIgnoreDirective
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user