[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
Generated
+377
-377
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.spec.utils.models.LinkedSpecTest
|
||||
import org.jetbrains.kotlin.spec.utils.models.SpecPlace
|
||||
import org.jetbrains.kotlin.spec.utils.parsers.CommonParser
|
||||
import org.jetbrains.kotlin.spec.utils.parsers.LinkedSpecTestPatterns
|
||||
import org.jetbrains.kotlin.test.utils.isCustomTestData
|
||||
import java.io.File
|
||||
|
||||
object TestsJsonMapGenerator {
|
||||
@@ -68,7 +69,7 @@ object TestsJsonMapGenerator {
|
||||
TestArea.values().forEach { testArea ->
|
||||
File(testOrigin.getFilePath(testArea)).walkTopDown()
|
||||
.forEach testFiles@{ file ->
|
||||
if (!file.isFile || file.extension != "kt" || file.name.endsWith(".fir.kt")) return@testFiles
|
||||
if (!file.isFile || file.extension != "kt" || file.isCustomTestData) return@testFiles
|
||||
if (isImplementationTest && !LinkedSpecTestPatterns.testInfoPattern.matcher(file.readText()).find())
|
||||
return@testFiles
|
||||
|
||||
|
||||
+4
-5
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.spec.utils.tasks
|
||||
|
||||
import org.jetbrains.kotlin.generators.generateTestGroupSuiteWithJUnit5
|
||||
import org.jetbrains.kotlin.generators.impl.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.spec.checkers.AbstractDiagnosticsTestSpec
|
||||
import org.jetbrains.kotlin.spec.codegen.AbstractBlackBoxCodegenTestSpec
|
||||
@@ -14,8 +15,8 @@ import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.SPEC_TEST_PATH
|
||||
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TESTS_MAP_FILENAME
|
||||
import org.jetbrains.kotlin.spec.utils.SectionsJsonMapGenerator
|
||||
import org.jetbrains.kotlin.spec.utils.TestsJsonMapGenerator
|
||||
import org.jetbrains.kotlin.generators.generateTestGroupSuiteWithJUnit5
|
||||
import org.jetbrains.kotlin.test.runners.AbstractFirDiagnosticTestSpec
|
||||
import org.jetbrains.kotlin.test.utils.CUSTOM_TEST_DATA_EXTENSION_PATTERN
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
|
||||
@@ -39,15 +40,13 @@ fun detectDirsWithTestsMapFileOnly(dirName: String, baseDir: String = "."): List
|
||||
}
|
||||
|
||||
fun generateTests() {
|
||||
val excludedFirTestdataPattern = "^(.+)\\.fir\\.kts?\$"
|
||||
|
||||
generateTestGroupSuite {
|
||||
testGroup(SPEC_TEST_PATH, SPEC_TESTDATA_PATH) {
|
||||
testClass<AbstractDiagnosticsTestSpec> {
|
||||
model(
|
||||
"diagnostics",
|
||||
excludeDirs = listOf("helpers") + detectDirsWithTestsMapFileOnly("diagnostics"),
|
||||
excludedPattern = excludedFirTestdataPattern
|
||||
excludedPattern = CUSTOM_TEST_DATA_EXTENSION_PATTERN
|
||||
)
|
||||
}
|
||||
|
||||
@@ -70,7 +69,7 @@ fun generateTests() {
|
||||
model(
|
||||
"diagnostics",
|
||||
excludeDirs = listOf("helpers") + detectDirsWithTestsMapFileOnly("diagnostics"),
|
||||
excludedPattern = excludedFirTestdataPattern
|
||||
excludedPattern = CUSTOM_TEST_DATA_EXTENSION_PATTERN
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user