[LL FIR] KT-50732 Add support for LL FIR-specific tests (.ll.kt)
- `.ll.kt` test data can be added in cases where LL FIR resolution
legally diverges from K2 compiler results.
- Each `.ll.kt` test is prefixed with an `LL_FIR_DIVERGENCE` directive
which must explain why the test may diverge from K2 compiler results.
- `LLFirDivergenceCommentChecker` ensures that each `.ll.kt` file
contains an `LL_FIR_DIVERGENCE` directive.
- `LLFirIdenticalChecker` results in an assertion error if the `.ll.kt`
test and its base test are completely identical, including in their
meta info (but ignoring `LL_FIR_DIVERGENCE`).
- The checker additionally ensures that the base source file and the
`.ll.kt` source file have identical Kotlin source code (ignoring
meta info and `LL_FIR_DIVERGENCE`). This ensures that both tests
test the exact same thing.
- `.ll.kt` files are ignored by select test generators, in addition to
`.fir.kt` files.
This commit is contained in:
committed by
teamcity
parent
b0db0f59b4
commit
88ac5727cc
+36
-35
@@ -10,38 +10,39 @@ import org.jetbrains.kotlin.generators.util.TestGeneratorUtil
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.jetbrains.kotlin.test.runners.*
|
||||
import org.jetbrains.kotlin.test.runners.codegen.*
|
||||
import org.jetbrains.kotlin.test.runners.ir.AbstractLoweredIrInterpreterTest
|
||||
import org.jetbrains.kotlin.test.runners.ir.AbstractFir2IrTextTest
|
||||
import org.jetbrains.kotlin.test.runners.ir.AbstractIrTextTest
|
||||
import org.jetbrains.kotlin.test.runners.ir.AbstractLightTreeFir2IrTextTest
|
||||
import org.jetbrains.kotlin.test.runners.ir.AbstractLoweredIrInterpreterTest
|
||||
import org.jetbrains.kotlin.test.runners.ir.interpreter.AbstractIrInterpreterAfterFir2IrTest
|
||||
import org.jetbrains.kotlin.test.runners.ir.interpreter.AbstractIrInterpreterAfterPsi2IrTest
|
||||
import org.jetbrains.kotlin.test.utils.CUSTOM_TEST_DATA_EXTENSION_PATTERN
|
||||
import org.jetbrains.kotlin.visualizer.fir.AbstractFirVisualizerTest
|
||||
import org.jetbrains.kotlin.visualizer.psi.AbstractPsiVisualizerTest
|
||||
|
||||
fun generateJUnit5CompilerTests(args: Array<String>) {
|
||||
val excludedFirTestdataPattern = "^(.+)\\.fir\\.kts?\$"
|
||||
val excludedCustomTestdataPattern = CUSTOM_TEST_DATA_EXTENSION_PATTERN
|
||||
|
||||
generateTestGroupSuiteWithJUnit5(args) {
|
||||
testGroup(testsRoot = "compiler/tests-common-new/tests-gen", testDataRoot = "compiler/testData") {
|
||||
testClass<AbstractDiagnosticTest> {
|
||||
model("diagnostics/tests", pattern = "^(.*)\\.kts?$", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/testsWithStdLib", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/tests", pattern = "^(.*)\\.kts?$", excludedPattern = excludedCustomTestdataPattern)
|
||||
model("diagnostics/testsWithStdLib", excludedPattern = excludedCustomTestdataPattern)
|
||||
}
|
||||
|
||||
testClass<AbstractDiagnosticUsingJavacTest> {
|
||||
model("diagnostics/tests/javac", pattern = "^(.*)\\.kts?$", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/tests/javac", pattern = "^(.*)\\.kts?$", excludedPattern = excludedCustomTestdataPattern)
|
||||
}
|
||||
|
||||
testClass<AbstractDiagnosticsTestWithJsStdLib> {
|
||||
model("diagnostics/testsWithJsStdLib", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/testsWithJsStdLib", excludedPattern = excludedCustomTestdataPattern)
|
||||
}
|
||||
|
||||
testClass<AbstractDiagnosticsTestWithOldJvmBackend> {
|
||||
model(
|
||||
"diagnostics/testsWithJvmBackend",
|
||||
targetBackend = TargetBackend.JVM_OLD,
|
||||
excludedPattern = excludedFirTestdataPattern
|
||||
excludedPattern = excludedCustomTestdataPattern
|
||||
)
|
||||
}
|
||||
|
||||
@@ -50,37 +51,37 @@ fun generateJUnit5CompilerTests(args: Array<String>) {
|
||||
"diagnostics/testsWithJvmBackend",
|
||||
pattern = "^(.+)\\.kts?$",
|
||||
targetBackend = TargetBackend.JVM_IR,
|
||||
excludedPattern = excludedFirTestdataPattern
|
||||
excludedPattern = excludedCustomTestdataPattern
|
||||
)
|
||||
}
|
||||
|
||||
testClass<AbstractDiagnosticsNativeTest> {
|
||||
model("diagnostics/nativeTests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/nativeTests", excludedPattern = excludedCustomTestdataPattern)
|
||||
}
|
||||
|
||||
testClass<AbstractDiagnosticsWithMultiplatformCompositeAnalysisTest> {
|
||||
model(
|
||||
"diagnostics/testsWithMultiplatformCompositeAnalysis",
|
||||
pattern = "^(.*)\\.kts?$", excludedPattern = excludedFirTestdataPattern
|
||||
pattern = "^(.*)\\.kts?$", excludedPattern = excludedCustomTestdataPattern
|
||||
)
|
||||
}
|
||||
|
||||
testClass<AbstractForeignAnnotationsSourceJavaTest> {
|
||||
model("diagnostics/foreignAnnotationsTests/tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java8Tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java11Tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java8Tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java11Tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
}
|
||||
|
||||
testClass<AbstractForeignAnnotationsCompiledJavaTest> {
|
||||
model("diagnostics/foreignAnnotationsTests/tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java8Tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java11Tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java8Tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java11Tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
}
|
||||
|
||||
testClass<AbstractForeignAnnotationsCompiledJavaWithPsiClassReadingTest> {
|
||||
model("diagnostics/foreignAnnotationsTests/tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java8Tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java11Tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java8Tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java11Tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
}
|
||||
|
||||
testClass<AbstractBlackBoxCodegenTest> {
|
||||
@@ -192,51 +193,51 @@ fun generateJUnit5CompilerTests(args: Array<String>) {
|
||||
|
||||
testGroup(testsRoot = "compiler/fir/analysis-tests/tests-gen", testDataRoot = "compiler/testData") {
|
||||
testClass<AbstractFirDiagnosticTest>(suiteTestClassName = "FirOldFrontendDiagnosticsTestGenerated") {
|
||||
model("diagnostics/tests", pattern = "^(.*)\\.kts?$", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/testsWithStdLib", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/tests", pattern = "^(.*)\\.kts?$", excludedPattern = excludedCustomTestdataPattern)
|
||||
model("diagnostics/testsWithStdLib", excludedPattern = excludedCustomTestdataPattern)
|
||||
}
|
||||
|
||||
testClass<AbstractFirDiagnosticsWithLightTreeTest>(
|
||||
suiteTestClassName = "FirOldFrontendDiagnosticsWithLightTreeTestGenerated"
|
||||
) {
|
||||
model("diagnostics/tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/testsWithStdLib", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
model("diagnostics/testsWithStdLib", excludedPattern = excludedCustomTestdataPattern)
|
||||
}
|
||||
|
||||
testClass<AbstractFirForeignAnnotationsSourceJavaTest>(
|
||||
suiteTestClassName = "FirOldFrontendForeignAnnotationsSourceJavaTestGenerated"
|
||||
) {
|
||||
model("diagnostics/foreignAnnotationsTests/tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java8Tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java11Tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java8Tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java11Tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
}
|
||||
|
||||
testClass<AbstractFirForeignAnnotationsCompiledJavaTest>(
|
||||
suiteTestClassName = "FirOldFrontendForeignAnnotationsCompiledJavaTestGenerated"
|
||||
) {
|
||||
model("diagnostics/foreignAnnotationsTests/tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java8Tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java11Tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java8Tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java11Tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
}
|
||||
|
||||
testClass<AbstractFirForeignAnnotationsCompiledJavaWithPsiClassReadingTest>(
|
||||
suiteTestClassName = "FirOldFrontendForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated"
|
||||
) {
|
||||
model("diagnostics/foreignAnnotationsTests/tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java8Tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java11Tests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java8Tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
model("diagnostics/foreignAnnotationsTests/java11Tests", excludedPattern = excludedCustomTestdataPattern)
|
||||
}
|
||||
|
||||
testClass<AbstractFirNativeDiagnosticsTest>(
|
||||
suiteTestClassName = "FirOldFrontendNativeDiagnosticsTestGenerated"
|
||||
) {
|
||||
model("diagnostics/nativeTests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/nativeTests", excludedPattern = excludedCustomTestdataPattern)
|
||||
}
|
||||
|
||||
testClass<AbstractFirNativeDiagnosticsWithLightTreeTest>(
|
||||
suiteTestClassName = "FirOldFrontendNativeDiagnosticsWithLightTreeTestGenerated"
|
||||
) {
|
||||
model("diagnostics/nativeTests", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/nativeTests", excludedPattern = excludedCustomTestdataPattern)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,7 +275,7 @@ fun generateJUnit5CompilerTests(args: Array<String>) {
|
||||
}
|
||||
|
||||
testClass<AbstractFirDiagnosticsTestWithJvmIrBackend>(suiteTestClassName = "FirOldDiagnosticsTestWithJvmIrBackendGenerated") {
|
||||
model("diagnostics/testsWithJvmBackend", excludedPattern = excludedFirTestdataPattern)
|
||||
model("diagnostics/testsWithJvmBackend", excludedPattern = excludedCustomTestdataPattern)
|
||||
}
|
||||
|
||||
testClass<AbstractFirSerializeCompileKotlinAgainstInlineKotlinTest> {
|
||||
|
||||
Reference in New Issue
Block a user