[Test] Migrate tests for java 15 to regular test infrastructure

This commit is contained in:
Dmitriy Novozhilov
2021-07-14 15:26:09 +03:00
committed by teamcityserver
parent 4f73ebbcbd
commit c168a561df
26 changed files with 267 additions and 413 deletions
@@ -41523,6 +41523,86 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/testsWithJava15")
@TestDataPath("$PROJECT_ROOT")
public class TestsWithJava15 {
@Test
public void testAllFilesPresentInTestsWithJava15() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/testsWithJava15"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@Nested
@TestMetadata("compiler/testData/codegen/box/testsWithJava15/records")
@TestDataPath("$PROJECT_ROOT")
public class Records {
@Test
public void testAllFilesPresentInRecords() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/testsWithJava15/records"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@Test
@TestMetadata("bytecodeShapeForJava.kt")
public void testBytecodeShapeForJava() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/bytecodeShapeForJava.kt");
}
@Test
@TestMetadata("collectionSizeOverrides.kt")
public void testCollectionSizeOverrides() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/collectionSizeOverrides.kt");
}
@Test
@TestMetadata("dataJvmRecord.kt")
public void testDataJvmRecord() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/dataJvmRecord.kt");
}
@Test
@TestMetadata("jvmRecordBinary.kt")
public void testJvmRecordBinary() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/jvmRecordBinary.kt");
}
@Test
@TestMetadata("propertiesOverrides.kt")
public void testPropertiesOverrides() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/propertiesOverrides.kt");
}
@Test
@TestMetadata("propertiesOverridesAllCompatibilityJvmDefault.kt")
public void testPropertiesOverridesAllCompatibilityJvmDefault() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/propertiesOverridesAllCompatibilityJvmDefault.kt");
}
@Test
@TestMetadata("propertiesOverridesEnableJvmDefault.kt")
public void testPropertiesOverridesEnableJvmDefault() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/propertiesOverridesEnableJvmDefault.kt");
}
@Test
@TestMetadata("recordDifferentPropertyOverride.kt")
public void testRecordDifferentPropertyOverride() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/recordDifferentPropertyOverride.kt");
}
@Test
@TestMetadata("recordDifferentSyntheticProperty.kt")
public void testRecordDifferentSyntheticProperty() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/recordDifferentSyntheticProperty.kt");
}
@Test
@TestMetadata("recordPropertyAccess.kt")
public void testRecordPropertyAccess() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/recordPropertyAccess.kt");
}
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/testsWithJava9")
@TestDataPath("$PROJECT_ROOT")
@@ -41679,6 +41679,86 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/testsWithJava15")
@TestDataPath("$PROJECT_ROOT")
public class TestsWithJava15 {
@Test
public void testAllFilesPresentInTestsWithJava15() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/testsWithJava15"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Nested
@TestMetadata("compiler/testData/codegen/box/testsWithJava15/records")
@TestDataPath("$PROJECT_ROOT")
public class Records {
@Test
public void testAllFilesPresentInRecords() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/testsWithJava15/records"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("bytecodeShapeForJava.kt")
public void testBytecodeShapeForJava() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/bytecodeShapeForJava.kt");
}
@Test
@TestMetadata("collectionSizeOverrides.kt")
public void testCollectionSizeOverrides() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/collectionSizeOverrides.kt");
}
@Test
@TestMetadata("dataJvmRecord.kt")
public void testDataJvmRecord() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/dataJvmRecord.kt");
}
@Test
@TestMetadata("jvmRecordBinary.kt")
public void testJvmRecordBinary() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/jvmRecordBinary.kt");
}
@Test
@TestMetadata("propertiesOverrides.kt")
public void testPropertiesOverrides() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/propertiesOverrides.kt");
}
@Test
@TestMetadata("propertiesOverridesAllCompatibilityJvmDefault.kt")
public void testPropertiesOverridesAllCompatibilityJvmDefault() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/propertiesOverridesAllCompatibilityJvmDefault.kt");
}
@Test
@TestMetadata("propertiesOverridesEnableJvmDefault.kt")
public void testPropertiesOverridesEnableJvmDefault() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/propertiesOverridesEnableJvmDefault.kt");
}
@Test
@TestMetadata("recordDifferentPropertyOverride.kt")
public void testRecordDifferentPropertyOverride() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/recordDifferentPropertyOverride.kt");
}
@Test
@TestMetadata("recordDifferentSyntheticProperty.kt")
public void testRecordDifferentSyntheticProperty() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/recordDifferentSyntheticProperty.kt");
}
@Test
@TestMetadata("recordPropertyAccess.kt")
public void testRecordPropertyAccess() throws Exception {
runTest("compiler/testData/codegen/box/testsWithJava15/records/recordPropertyAccess.kt");
}
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/testsWithJava9")
@TestDataPath("$PROJECT_ROOT")
@@ -68,7 +68,7 @@ class JavaCompilerFacade(private val testServices: TestServices) {
}
private fun compileJavaFiles(module: TestModule, jvmTarget: JvmTarget, files: List<File>, javacOptions: List<String>, ignoreErrors: Boolean) {
val targetIsJava8OrLower = System.getProperty("java.version").startsWith("1.")
val targetIsJava8OrLower = System.getProperty("java.version").startsWith("1.") && jvmTarget <= JvmTarget.JVM_1_6
if (USE_JAVAC_BASED_ON_JVM_TARGET !in module.directives || targetIsJava8OrLower) {
org.jetbrains.kotlin.test.compileJavaFiles(
files,
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.test.TestJdkKind
import org.jetbrains.kotlin.test.clientserver.TestProxy
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.JDK_KIND
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.ENABLE_JVM_PREVIEW
import org.jetbrains.kotlin.test.directives.model.singleOrZeroValue
import org.jetbrains.kotlin.test.model.BinaryArtifacts
import org.jetbrains.kotlin.test.model.DependencyKind
@@ -199,14 +200,15 @@ class JvmBoxRunner(testServices: TestServices) : JvmBinaryArtifactHandler(testSe
"${mainFile.nameWithoutExtension}Kt"
).joinToString(".")
val command = arrayOf(
val command = listOfNotNull(
javaExe.absolutePath,
"-ea",
runIf(ENABLE_JVM_PREVIEW in module.directives) { "--enable-preview" },
"-classpath",
classPath.joinToString(File.pathSeparator, transform = { File(it.toURI()).absolutePath }),
mainFqName,
)
val process = ProcessBuilder(*command).inheritIO().start()
val process = ProcessBuilder(command).inheritIO().start()
process.waitFor(1, TimeUnit.MINUTES)
process.outputStream.flush()
return when (process.exitValue()) {
@@ -13,6 +13,9 @@ import org.jetbrains.kotlin.test.backend.handlers.BytecodeListingHandler
import org.jetbrains.kotlin.test.backend.handlers.BytecodeTextHandler
import org.jetbrains.kotlin.test.bind
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.IGNORE_DEXING
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.USE_JAVAC_BASED_ON_JVM_TARGET
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.DIAGNOSTICS
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.REPORT_ONLY_EXPLICITLY_DEFINED_DEBUG_INFO
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.JDK_KIND
@@ -53,12 +56,22 @@ abstract class AbstractJvmBlackBoxCodegenTestBase<R : ResultingArtifact.Frontend
}
forTestsMatching("compiler/testData/codegen/box/testsWithJava9/*") {
defaultDirectives {
JDK_KIND with TestJdkKind.FULL_JDK_9
+WITH_STDLIB
}
configureModernJavaTest(TestJdkKind.FULL_JDK_9)
}
forTestsMatching("compiler/testData/codegen/box/testsWithJava15/*") {
configureModernJavaTest(TestJdkKind.FULL_JDK_15)
}
enableMetaInfoHandler()
}
private fun TestConfigurationBuilder.configureModernJavaTest(jdkKind: TestJdkKind) {
defaultDirectives {
JDK_KIND with jdkKind
+WITH_STDLIB
+USE_JAVAC_BASED_ON_JVM_TARGET
+IGNORE_DEXING
}
}
}