FIR: add tests for IC with LT and new CLI pipeline

This commit is contained in:
Ilya Chernikov
2021-10-29 16:04:27 +02:00
committed by teamcity
parent a239f02a30
commit 3220900abe
9 changed files with 8831 additions and 0 deletions
@@ -0,0 +1,77 @@
/*
* Copyright 2010-2021 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.runners.ir;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/fir/fir2ir/testData/ir/irText")
@TestDataPath("$PROJECT_ROOT")
public class LightTreeFir2IrSpecificTextTestGenerated extends AbstractLightTreeFir2IrTextTest {
@Test
public void testAllFilesPresentInIrText() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/fir2ir/testData/ir/irText"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("sample.kt")
public void testSample() throws Exception {
runTest("compiler/fir/fir2ir/testData/ir/irText/sample.kt");
}
@Nested
@TestMetadata("compiler/fir/fir2ir/testData/ir/irText/properties")
@TestDataPath("$PROJECT_ROOT")
public class Properties {
@Test
public void testAllFilesPresentInProperties() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/fir2ir/testData/ir/irText/properties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Nested
@TestMetadata("compiler/fir/fir2ir/testData/ir/irText/properties/backingField")
@TestDataPath("$PROJECT_ROOT")
public class BackingField {
@Test
public void testAllFilesPresentInBackingField() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/fir2ir/testData/ir/irText/properties/backingField"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("backingFieldVisibility.kt")
public void testBackingFieldVisibility() throws Exception {
runTest("compiler/fir/fir2ir/testData/ir/irText/properties/backingField/backingFieldVisibility.kt");
}
@Test
@TestMetadata("explicitBackingFieldType.kt")
public void testExplicitBackingFieldType() throws Exception {
runTest("compiler/fir/fir2ir/testData/ir/irText/properties/backingField/explicitBackingFieldType.kt");
}
@Test
@TestMetadata("independentBackingFieldType.kt")
public void testIndependentBackingFieldType() throws Exception {
runTest("compiler/fir/fir2ir/testData/ir/irText/properties/backingField/independentBackingFieldType.kt");
}
@Test
@TestMetadata("propertyTypeNarrowing.kt")
public void testPropertyTypeNarrowing() throws Exception {
runTest("compiler/fir/fir2ir/testData/ir/irText/properties/backingField/propertyTypeNarrowing.kt");
}
}
}
}
@@ -0,0 +1,23 @@
/*
* 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.incremental
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.jetbrains.kotlin.incremental.testingUtils.BuildLogFinder
import java.io.File
abstract class AbstractIncrementalFirICLightTreeJvmCompilerRunnerTest : AbstractIncrementalJvmCompilerRunnerTest() {
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JVMCompilerArguments =
super.createCompilerArguments(destinationDir, testDir).apply {
useFir = true
useIR = true
useFirIC = true
useFirLT = true
}
override val buildLogFinder: BuildLogFinder
get() = BuildLogFinder(isGradleEnabled = true, isFirEnabled = true) // TODO: investigate cases that need isGradleEnabled - the combination looks fragile
}
@@ -0,0 +1,23 @@
/*
* 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.incremental
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.jetbrains.kotlin.incremental.testingUtils.BuildLogFinder
import java.io.File
abstract class AbstractIncrementalFirLightTreeJvmCompilerRunnerTest : AbstractIncrementalJvmCompilerRunnerTest() {
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JVMCompilerArguments =
super.createCompilerArguments(destinationDir, testDir).apply {
useFir = true
useIR = true
useFirIC = false
useFirLT = true
}
override val buildLogFinder: BuildLogFinder
get() = BuildLogFinder(isGradleEnabled = true, isFirEnabled = true) // TODO: investigate cases that need isGradleEnabled - the combination looks fragile
}
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.test.builders.firHandlersStep
import org.jetbrains.kotlin.test.builders.irHandlersStep
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.DUMP_IR
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.DUMP_KT_IR
import org.jetbrains.kotlin.test.directives.FirDiagnosticsDirectives
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2IrConverter
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade
@@ -122,3 +123,14 @@ open class AbstractFir2IrTextTest : AbstractIrTextTestBase<FirOutputArtifact>()
}
}
}
open class AbstractLightTreeFir2IrTextTest : AbstractFir2IrTextTest() {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
with (builder) {
defaultDirectives {
+FirDiagnosticsDirectives.USE_LIGHT_TREE
}
}
}
}
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.test.runners.*
import org.jetbrains.kotlin.test.runners.codegen.*
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.interpreter.AbstractIrInterpreterAfterFir2IrTest
import org.jetbrains.kotlin.test.runners.ir.interpreter.AbstractIrInterpreterAfterPsi2IrTest
import org.jetbrains.kotlin.visualizer.fir.AbstractFirVisualizerTest
@@ -253,6 +254,12 @@ fun generateJUnit5CompilerTests(args: Array<String>) {
model("ir/irText")
}
testClass<AbstractLightTreeFir2IrTextTest>(
suiteTestClassName = "LightTreeFir2IrSpecificTextTestGenerated"
) {
model("ir/irText")
}
testClass<AbstractFirBytecodeListingTest>(
suiteTestClassName = "Fir2IrSpecificBytecodeListingTestGenerated"
) {
@@ -277,6 +284,10 @@ fun generateJUnit5CompilerTests(args: Array<String>) {
model("ir/irText")
}
testClass<AbstractLightTreeFir2IrTextTest> {
model("ir/irText")
}
testClass<AbstractFirBytecodeTextTest> {
model("codegen/bytecodeText")
}
@@ -53,6 +53,8 @@ fun main(args: Array<String>) {
testClass<AbstractIncrementalJvmCompilerRunnerTest>(init = incrementalJvmTestData(TargetBackend.JVM_IR))
testClass<AbstractIncrementalJvmOldBackendCompilerRunnerTest>(init = incrementalJvmTestData(TargetBackend.JVM))
testClass<AbstractIncrementalFirJvmCompilerRunnerTest>(init = incrementalJvmTestData(TargetBackend.JVM_IR))
testClass<AbstractIncrementalFirICLightTreeJvmCompilerRunnerTest>(init = incrementalJvmTestData(TargetBackend.JVM_IR))
testClass<AbstractIncrementalFirLightTreeJvmCompilerRunnerTest>(init = incrementalJvmTestData(TargetBackend.JVM_IR))
testClass<AbstractIncrementalJsCompilerRunnerTest> {
model("incremental/pureKotlin", extension = null, recursive = false)