[Test] Migrate AbstractDiagnosticsWithJdk15Test to new infrastructure

This commit is contained in:
Dmitriy Novozhilov
2020-12-22 12:05:01 +03:00
committed by TeamCityServer
parent 02fb11a2cd
commit a9f913a97f
37 changed files with 521 additions and 144 deletions
@@ -28332,6 +28332,96 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/testsWithJava15")
@TestDataPath("$PROJECT_ROOT")
public class TestsWithJava15 extends AbstractDiagnosticTest {
@Test
public void testAllFilesPresentInTestsWithJava15() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/testsWithJava15"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord")
@TestDataPath("$PROJECT_ROOT")
public class JvmRecord extends AbstractDiagnosticTest {
@Test
public void testAllFilesPresentInJvmRecord() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("diagnostics.kt")
public void testDiagnostics() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/diagnostics.kt");
}
@Test
@TestMetadata("disabledFeature.kt")
public void testDisabledFeature() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/disabledFeature.kt");
}
@Test
@TestMetadata("irrelevantFields.kt")
public void testIrrelevantFields() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/irrelevantFields.kt");
}
@Test
@TestMetadata("jvmRecordDescriptorStructure.kt")
public void testJvmRecordDescriptorStructure() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt");
}
@Test
@TestMetadata("simpleRecords.kt")
public void testSimpleRecords() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/simpleRecords.kt");
}
@Test
@TestMetadata("supertypesCheck.kt")
public void testSupertypesCheck() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/supertypesCheck.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses")
@TestDataPath("$PROJECT_ROOT")
public class SealedClasses extends AbstractDiagnosticTest {
@Test
public void testAllFilesPresentInSealedClasses() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("javaSealedClassExhaustiveness.kt")
public void testJavaSealedClassExhaustiveness() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.kt");
}
@Test
@TestMetadata("javaSealedInterfaceExhaustiveness.kt")
public void testJavaSealedInterfaceExhaustiveness() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.kt");
}
@Test
@TestMetadata("kotlinInheritsJavaClass.kt")
public void testKotlinInheritsJavaClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses/kotlinInheritsJavaClass.kt");
}
@Test
@TestMetadata("kotlinInheritsJavaInterface.kt")
public void testKotlinInheritsJavaInterface() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.kt");
}
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/thisAndSuper")
@TestDataPath("$PROJECT_ROOT")
@@ -7,10 +7,12 @@ package org.jetbrains.kotlin.test.runners
import org.jetbrains.kotlin.config.ExplicitApiMode
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.test.TestJdkKind
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.REPORT_JVM_DIAGNOSTICS_ON_FRONTEND
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.JDK_KIND
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.USE_PSI_CLASS_FILES_READING
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.WITH_REFLECT
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.WITH_STDLIB
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.EXPLICIT_API_MODE
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.USE_EXPERIMENTAL
@@ -80,5 +82,13 @@ abstract class AbstractDiagnosticTest : AbstractKotlinCompilerTest() {
+WITH_STDLIB
}
}
forTestsMatching("compiler/testData/diagnostics/tests/testsWithJava15/*") {
defaultDirectives {
JDK_KIND with TestJdkKind.FULL_JDK_15
+WITH_STDLIB
+WITH_REFLECT
}
}
}
}
@@ -6,15 +6,14 @@
package org.jetbrains.kotlin.test.runners
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.test.TestJdkKind
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.FirDiagnosticsDirectives
import org.jetbrains.kotlin.test.directives.FirDiagnosticsDirectives.COMPARE_WITH_LIGHT_TREE
import org.jetbrains.kotlin.test.directives.FirDiagnosticsDirectives.FIR_DUMP
import org.jetbrains.kotlin.test.directives.FirDiagnosticsDirectives.USE_LIGHT_TREE
import org.jetbrains.kotlin.test.directives.FirDiagnosticsDirectives.WITH_EXTENDED_CHECKERS
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.WITH_STDLIB
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives
import org.jetbrains.kotlin.test.frontend.fir.FirFailingTestSuppressor
import org.jetbrains.kotlin.test.frontend.fir.FirFrontendFacade
import org.jetbrains.kotlin.test.frontend.fir.handlers.*
@@ -82,6 +81,14 @@ abstract class AbstractFirDiagnosticTest : AbstractKotlinCompilerTest() {
+WITH_EXTENDED_CHECKERS
}
}
forTestsMatching("compiler/testData/diagnostics/tests/testsWithJava15/*") {
defaultDirectives {
JvmEnvironmentConfigurationDirectives.JDK_KIND with TestJdkKind.FULL_JDK_15
+WITH_STDLIB
+JvmEnvironmentConfigurationDirectives.WITH_REFLECT
}
}
}
}
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.test.ConfigurationKind
import org.jetbrains.kotlin.test.TestJdkKind
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives
import org.jetbrains.kotlin.test.directives.model.DirectivesContainer
import org.jetbrains.kotlin.test.directives.model.RegisteredDirectives
import org.jetbrains.kotlin.test.model.BackendKinds
@@ -62,6 +63,9 @@ class JvmEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfig
TestJdkKind.FULL_JDK_9 -> {
configuration.put(JVMConfigurationKeys.JDK_HOME, KtTestUtil.getJdk9Home())
}
TestJdkKind.FULL_JDK_15 -> {
configuration.put(JVMConfigurationKeys.JDK_HOME, KtTestUtil.getJdk15Home())
}
TestJdkKind.FULL_JDK -> {
if (SystemInfo.IS_AT_LEAST_JAVA9) {
configuration.put(JVMConfigurationKeys.JDK_HOME, File(System.getProperty("java.home")))
@@ -96,6 +100,10 @@ class JvmEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfig
configuration.addJvmClasspathRoot(ForTestCompileRuntime.androidAnnotationsForTests())
}
if (LanguageSettingsDirectives.ENABLE_JVM_PREVIEW in module.directives) {
configuration.put(JVMConfigurationKeys.ENABLE_JVM_PREVIEW, true)
}
val isIr = module.backendKind == BackendKinds.IrBackend
configuration.put(JVMConfigurationKeys.IR, isIr)