Suppress some JMV IR inliner delegation tests for K2
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_INLINER_K2: IR
|
||||||
// FILE: 1.kt
|
// FILE: 1.kt
|
||||||
|
|
||||||
package x
|
package x
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_INLINER_K2: IR
|
||||||
// FILE: 1.kt
|
// FILE: 1.kt
|
||||||
package test
|
package test
|
||||||
|
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_INLINER_K2: IR
|
||||||
// IGNORE_BACKEND_MULTI_MODULE: JVM, JVM_MULTI_MODULE_IR_AGAINST_OLD
|
// IGNORE_BACKEND_MULTI_MODULE: JVM, JVM_MULTI_MODULE_IR_AGAINST_OLD
|
||||||
// FILE: test.kt
|
// FILE: test.kt
|
||||||
package test
|
package test
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_INLINER_K2: IR
|
||||||
// FILE: 1.kt
|
// FILE: 1.kt
|
||||||
package test
|
package test
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_INLINER_K2: IR
|
||||||
// FILE: 1.kt
|
// FILE: 1.kt
|
||||||
package test
|
package test
|
||||||
|
|
||||||
|
|||||||
+34
-10
@@ -9,8 +9,11 @@ import org.jetbrains.kotlin.test.WrappedException
|
|||||||
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives
|
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives
|
||||||
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives
|
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives
|
||||||
import org.jetbrains.kotlin.test.directives.model.DirectivesContainer
|
import org.jetbrains.kotlin.test.directives.model.DirectivesContainer
|
||||||
|
import org.jetbrains.kotlin.test.directives.model.ValueDirective
|
||||||
import org.jetbrains.kotlin.test.model.AfterAnalysisChecker
|
import org.jetbrains.kotlin.test.model.AfterAnalysisChecker
|
||||||
|
import org.jetbrains.kotlin.test.model.FrontendKinds
|
||||||
import org.jetbrains.kotlin.test.services.TestServices
|
import org.jetbrains.kotlin.test.services.TestServices
|
||||||
|
import org.jetbrains.kotlin.test.services.defaultsProvider
|
||||||
import org.jetbrains.kotlin.test.services.moduleStructure
|
import org.jetbrains.kotlin.test.services.moduleStructure
|
||||||
|
|
||||||
enum class TargetInliner {
|
enum class TargetInliner {
|
||||||
@@ -22,19 +25,40 @@ class BlackBoxInlinerCodegenSuppressor(testServices: TestServices) : AfterAnalys
|
|||||||
get() = listOf(CodegenTestDirectives)
|
get() = listOf(CodegenTestDirectives)
|
||||||
|
|
||||||
override fun suppressIfNeeded(failedAssertions: List<WrappedException>): List<WrappedException> {
|
override fun suppressIfNeeded(failedAssertions: List<WrappedException>): List<WrappedException> {
|
||||||
val ignoreDirectives = testServices.moduleStructure.allDirectives[CodegenTestDirectives.IGNORE_INLINER]
|
val targetFrontend = testServices.defaultsProvider.defaultFrontend
|
||||||
if (ignoreDirectives.size > 1) {
|
|
||||||
throw IllegalArgumentException("Directive should contain IGNORE_INLINER only one value")
|
|
||||||
}
|
|
||||||
|
|
||||||
val ignoreDirective = ignoreDirectives.singleOrNull() ?: return failedAssertions
|
val commonResult = suppressForTargetFrontend(failedAssertions, CodegenTestDirectives.IGNORE_INLINER)
|
||||||
val enabledIrInliner = LanguageSettingsDirectives.ENABLE_JVM_IR_INLINER in testServices.moduleStructure.allDirectives
|
if (commonResult != null) return commonResult
|
||||||
val unmuteError = listOf(AssertionError("Looks like this test can be unmuted. Please remove IGNORE_INLINER directive.").wrap())
|
|
||||||
|
|
||||||
return when {
|
return when (targetFrontend) {
|
||||||
ignoreDirective == TargetInliner.IR && enabledIrInliner -> if (failedAssertions.isNotEmpty()) emptyList() else unmuteError
|
FrontendKinds.ClassicFrontend -> {
|
||||||
ignoreDirective == TargetInliner.BYTECODE && !enabledIrInliner -> if (failedAssertions.isNotEmpty()) emptyList() else unmuteError
|
suppressForTargetFrontend(failedAssertions, CodegenTestDirectives.IGNORE_INLINER_K1) ?: failedAssertions
|
||||||
|
}
|
||||||
|
FrontendKinds.FIR -> {
|
||||||
|
suppressForTargetFrontend(failedAssertions, CodegenTestDirectives.IGNORE_INLINER_K2) ?: failedAssertions
|
||||||
|
}
|
||||||
else -> failedAssertions
|
else -> failedAssertions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun suppressForTargetFrontend(
|
||||||
|
failedAssertions: List<WrappedException>,
|
||||||
|
directive: ValueDirective<TargetInliner>
|
||||||
|
): List<WrappedException>? {
|
||||||
|
val directiveName = directive.name
|
||||||
|
val ignoreDirectives = testServices.moduleStructure.allDirectives[directive]
|
||||||
|
if (ignoreDirectives.size > 1) {
|
||||||
|
throw IllegalArgumentException("Directive $directiveName should contains only one value")
|
||||||
|
}
|
||||||
|
|
||||||
|
val ignoreDirective = ignoreDirectives.singleOrNull()
|
||||||
|
val enabledIrInliner = LanguageSettingsDirectives.ENABLE_JVM_IR_INLINER in testServices.moduleStructure.allDirectives
|
||||||
|
val unmuteError = listOf(AssertionError("Looks like this test can be unmuted. Please remove $directiveName directive.").wrap())
|
||||||
|
|
||||||
|
if (ignoreDirective == TargetInliner.IR && enabledIrInliner || ignoreDirective == TargetInliner.BYTECODE && !enabledIrInliner) {
|
||||||
|
return if (failedAssertions.isNotEmpty()) emptyList() else unmuteError
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+11
-1
@@ -51,7 +51,17 @@ object CodegenTestDirectives : SimpleDirectivesContainer() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
val IGNORE_INLINER by enumDirective<TargetInliner>(
|
val IGNORE_INLINER by enumDirective<TargetInliner>(
|
||||||
description = "Ignore failures of tests with given inliner",
|
description = "Ignore failures of tests with given inliner for all frontend kinds",
|
||||||
|
applicability = Global
|
||||||
|
)
|
||||||
|
|
||||||
|
val IGNORE_INLINER_K1 by enumDirective<TargetInliner>(
|
||||||
|
description = "Ignore failures of tests with given inliner for K1 compiler",
|
||||||
|
applicability = Global
|
||||||
|
)
|
||||||
|
|
||||||
|
val IGNORE_INLINER_K2 by enumDirective<TargetInliner>(
|
||||||
|
description = "Ignore failures of tests with given inliner for K2 compiler",
|
||||||
applicability = Global
|
applicability = Global
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user