[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:
Marco Pennekamp
2022-12-02 19:01:54 +01:00
committed by teamcity
parent b0db0f59b4
commit 88ac5727cc
52 changed files with 3706 additions and 3010 deletions
@@ -16,9 +16,7 @@ import org.jetbrains.kotlin.generators.TestGroupSuite
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration
import org.jetbrains.kotlin.spec.utils.tasks.detectDirsWithTestsMapFileOnly
import org.jetbrains.kotlin.test.runners.AbstractFirDiagnosticTestSpec
private const val excludedFirTestdataPattern = "^(.+)\\.fir\\.kts?\$"
import org.jetbrains.kotlin.test.utils.CUSTOM_TEST_DATA_EXTENSION_PATTERN
internal fun TestGroupSuite.generateFirLowLevelApiTests() {
testGroup("analysis/low-level-api-fir/tests", "compiler/fir/raw-fir/psi2fir/testData") {
@@ -78,11 +76,11 @@ internal fun TestGroupSuite.generateFirLowLevelApiTests() {
testClass<AbstractDiagnosisCompilerTestDataTest>(suiteTestClassName = "DiagnosisCompilerTestFE10TestdataTestGenerated") {
model(
"diagnostics/tests",
excludedPattern = excludedFirTestdataPattern,
excludedPattern = CUSTOM_TEST_DATA_EXTENSION_PATTERN,
)
model(
"diagnostics/testsWithStdLib",
excludedPattern = excludedFirTestdataPattern,
excludedPattern = CUSTOM_TEST_DATA_EXTENSION_PATTERN,
excludeDirs = listOf("native")
)
}
@@ -94,7 +92,7 @@ internal fun TestGroupSuite.generateFirLowLevelApiTests() {
model(
"diagnostics",
excludeDirs = listOf("helpers") + detectDirsWithTestsMapFileOnly("diagnostics"),
excludedPattern = excludedFirTestdataPattern,
excludedPattern = CUSTOM_TEST_DATA_EXTENSION_PATTERN,
)
}
}