K1: mute failing test with slow assertions
Note: in this test, we create a flexible type from two captured types during substitution, which provokes exception from FlexibleTypeImpl.runAssertions() (they are run only in test mode) Related to KT-54198
This commit is contained in:
committed by
teamcity
parent
e9bb0f4fda
commit
591992dc12
Vendored
+1
@@ -0,0 +1 @@
|
||||
java.lang.AssertionError: Lower bound CapturedType(in (Model..Model?)) of a flexible type must be a subtype of the upper bound CapturedType(in (Model..Model?))?
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2010-2022 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.frontend
|
||||
|
||||
import org.jetbrains.kotlin.test.WrappedException
|
||||
import org.jetbrains.kotlin.test.model.AfterAnalysisChecker
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractFailingTestSuppressor(testServices: TestServices) : AfterAnalysisChecker(testServices) {
|
||||
|
||||
protected abstract fun testFile(): File
|
||||
|
||||
protected abstract fun hasFail(failedAssertions: List<WrappedException>): Boolean
|
||||
|
||||
override fun suppressIfNeeded(failedAssertions: List<WrappedException>): List<WrappedException> {
|
||||
val failFile = testFile().parentFile.resolve("${testFile().nameWithoutExtension}.fail").takeIf { it.exists() }
|
||||
?: return failedAssertions
|
||||
val failReason = failFile.readText().trim()
|
||||
if (hasFail(failedAssertions) || failReason == INCONSISTENT_DIAGNOSTICS) return emptyList()
|
||||
return failedAssertions + AssertionError("Fail file exists but no exception was thrown. Please remove ${failFile.name}").wrap()
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val INCONSISTENT_DIAGNOSTICS = "INCONSISTENT_DIAGNOSTICS"
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2010-2022 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.frontend.classic
|
||||
|
||||
import org.jetbrains.kotlin.test.WrappedException
|
||||
import org.jetbrains.kotlin.test.frontend.AbstractFailingTestSuppressor
|
||||
import org.jetbrains.kotlin.test.model.FrontendKinds
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.moduleStructure
|
||||
import java.io.File
|
||||
|
||||
class ClassicFrontendFailingTestSuppressor(testServices: TestServices) : AbstractFailingTestSuppressor(testServices) {
|
||||
|
||||
override fun testFile(): File {
|
||||
return testServices.moduleStructure.originalTestDataFiles.first()
|
||||
}
|
||||
|
||||
override fun hasFail(failedAssertions: List<WrappedException>): Boolean {
|
||||
return failedAssertions.any {
|
||||
when (it) {
|
||||
is WrappedException.FromFacade -> it.facade is ClassicFrontendFacade
|
||||
is WrappedException.FromHandler -> it.handler.artifactKind == FrontendKinds.ClassicFrontend
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
-14
@@ -6,30 +6,26 @@
|
||||
package org.jetbrains.kotlin.test.frontend.fir
|
||||
|
||||
import org.jetbrains.kotlin.test.WrappedException
|
||||
import org.jetbrains.kotlin.test.model.AfterAnalysisChecker
|
||||
import org.jetbrains.kotlin.test.frontend.AbstractFailingTestSuppressor
|
||||
import org.jetbrains.kotlin.test.model.FrontendKinds
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.moduleStructure
|
||||
import org.jetbrains.kotlin.test.utils.firTestDataFile
|
||||
import java.io.File
|
||||
|
||||
class FirFailingTestSuppressor(testServices: TestServices) : AfterAnalysisChecker(testServices) {
|
||||
override fun suppressIfNeeded(failedAssertions: List<WrappedException>): List<WrappedException> {
|
||||
val testFile = testServices.moduleStructure.originalTestDataFiles.first().firTestDataFile
|
||||
val failFile = testFile.parentFile.resolve("${testFile.nameWithoutExtension}.fail").takeIf { it.exists() }
|
||||
?: return failedAssertions
|
||||
val failReason = failFile.readText().trim()
|
||||
val hasFail = failedAssertions.any {
|
||||
class FirFailingTestSuppressor(testServices: TestServices) : AbstractFailingTestSuppressor(testServices) {
|
||||
|
||||
override fun testFile(): File {
|
||||
return testServices.moduleStructure.originalTestDataFiles.first().firTestDataFile
|
||||
}
|
||||
|
||||
override fun hasFail(failedAssertions: List<WrappedException>): Boolean {
|
||||
return failedAssertions.any {
|
||||
when (it) {
|
||||
is WrappedException.FromFacade -> it.facade is FirFrontendFacade
|
||||
is WrappedException.FromHandler -> it.handler.artifactKind == FrontendKinds.FIR
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
if (hasFail || failReason == INCONSISTENT_DIAGNOSTICS) return emptyList()
|
||||
return failedAssertions + AssertionError("Fail file exists but no exception was thrown. Please remove ${failFile.name}").wrap()
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val INCONSISTENT_DIAGNOSTICS = "INCONSISTENT_DIAGNOSTICS"
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirective
|
||||
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.EXPLICIT_API_MODE
|
||||
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.LANGUAGE
|
||||
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.OPT_IN
|
||||
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFailingTestSuppressor
|
||||
import org.jetbrains.kotlin.test.frontend.classic.handlers.*
|
||||
import org.jetbrains.kotlin.test.model.DependencyKind
|
||||
import org.jetbrains.kotlin.test.model.FrontendKinds
|
||||
@@ -82,7 +83,10 @@ abstract class AbstractDiagnosticTest : AbstractKotlinCompilerTest() {
|
||||
)
|
||||
}
|
||||
|
||||
useAfterAnalysisCheckers(::FirTestDataConsistencyHandler)
|
||||
useAfterAnalysisCheckers(
|
||||
::FirTestDataConsistencyHandler,
|
||||
::ClassicFrontendFailingTestSuppressor
|
||||
)
|
||||
|
||||
forTestsMatching("compiler/testData/diagnostics/testsWithStdLib/*") {
|
||||
defaultDirectives {
|
||||
|
||||
Reference in New Issue
Block a user