[Tests] Re-enable K1 IC tests for expect-actual

^KT-60831 fixed
^KT-60831 next step KT-63183


Merge-request: KT-MR-12855
Merged-by: Evgenii Mazhukin <evgenii.mazhukin@jetbrains.com>
This commit is contained in:
Evgenii Mazhukin
2023-11-06 19:46:43 +00:00
committed by Space Team
parent 4050285fef
commit 20af98c776
27 changed files with 58 additions and 32 deletions
@@ -25,4 +25,4 @@ abstract class AbstractIncrementalK1JsLegacyMultiplatformJsCompilerRunnerTest :
multiPlatform = true
}
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
* Copyright 2010-2023 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,8 @@ abstract class AbstractIncrementalMultiplatformJvmCompilerRunnerTest : AbstractI
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JVMCompilerArguments {
return super.createCompilerArguments(destinationDir, testDir).apply {
multiPlatform = true
useK2 = false
languageVersion = "1.9"
}
}
}
}
@@ -68,29 +68,29 @@ public class IncrementalMultiplatformJvmCompilerRunnerTestGenerated extends Abst
}
}
@TestMetadata("jps/jps-plugin/testData/incremental/mpp/jvmOnly")
@TestMetadata("jps/jps-plugin/testData/incremental/mpp/jvmOnlyK1")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class JvmOnly extends AbstractIncrementalMultiplatformJvmCompilerRunnerTest {
public static class JvmOnlyK1 extends AbstractIncrementalMultiplatformJvmCompilerRunnerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInJvmOnly() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/mpp/jvmOnly"), Pattern.compile("^([^\\.]+)$"), null, true);
public void testAllFilesPresentInJvmOnlyK1() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/mpp/jvmOnlyK1"), Pattern.compile("^([^\\.]+)$"), null, true);
}
@TestMetadata("multifilePartChanged")
public void testMultifilePartChanged() throws Exception {
runTest("jps/jps-plugin/testData/incremental/mpp/jvmOnly/multifilePartChanged/");
runTest("jps/jps-plugin/testData/incremental/mpp/jvmOnlyK1/multifilePartChanged/");
}
@TestMetadata("optionalExpectationWithActual")
public void testOptionalExpectationWithActual() throws Exception {
runTest("jps/jps-plugin/testData/incremental/mpp/jvmOnly/optionalExpectationWithActual/");
runTest("jps/jps-plugin/testData/incremental/mpp/jvmOnlyK1/optionalExpectationWithActual/");
}
@TestMetadata("jps/jps-plugin/testData/incremental/mpp/jvmOnly/multifilePartChanged")
@TestMetadata("jps/jps-plugin/testData/incremental/mpp/jvmOnlyK1/multifilePartChanged")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class MultifilePartChanged extends AbstractIncrementalMultiplatformJvmCompilerRunnerTest {
@@ -99,11 +99,11 @@ public class IncrementalMultiplatformJvmCompilerRunnerTestGenerated extends Abst
}
public void testAllFilesPresentInMultifilePartChanged() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/mpp/jvmOnly/multifilePartChanged"), Pattern.compile("^([^\\.]+)$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/mpp/jvmOnlyK1/multifilePartChanged"), Pattern.compile("^([^\\.]+)$"), null, true);
}
}
@TestMetadata("jps/jps-plugin/testData/incremental/mpp/jvmOnly/optionalExpectationWithActual")
@TestMetadata("jps/jps-plugin/testData/incremental/mpp/jvmOnlyK1/optionalExpectationWithActual")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class OptionalExpectationWithActual extends AbstractIncrementalMultiplatformJvmCompilerRunnerTest {
@@ -112,7 +112,7 @@ public class IncrementalMultiplatformJvmCompilerRunnerTestGenerated extends Abst
}
public void testAllFilesPresentInOptionalExpectationWithActual() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/mpp/jvmOnly/optionalExpectationWithActual"), Pattern.compile("^([^\\.]+)$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/mpp/jvmOnlyK1/optionalExpectationWithActual"), Pattern.compile("^([^\\.]+)$"), null, true);
}
}
}
@@ -109,8 +109,13 @@ class SimpleTestClassModel(
val listFiles = rootFile.listFiles()
if (listFiles != null && (deep == null || deep == 0)) {
for (file in listFiles) {
val excluded = excludePattern != null && excludePattern.matcher(file.name).matches()
if (filenamePattern.matcher(file.name).matches() && !excluded) {
val excluded = let {
val name = file.name
val byPattern = excludePattern != null && excludePattern.matcher(name).matches()
val byDirectory = file.isDirectory && (name in excludeDirs || name in excludeDirsRecursively)
return@let byPattern || byDirectory
}
if (!excluded && filenamePattern.matcher(file.name).matches()) {
if (file.isDirectory && excludeParentDirs && dirHasSubDirs(file)) {
continue
}
@@ -50,6 +50,22 @@ import org.jetbrains.kotlinx.atomicfu.AbstractAtomicfuJsIrTest
import org.jetbrains.kotlinx.atomicfu.AbstractAtomicfuJvmIrTest
import org.junit.jupiter.api.Tag
private class ExcludePattern {
companion object {
private const val MEMBER_ALIAS = "(^removeMemberTypeAlias)|(^addMemberTypeAlias)"
private const val ALL_EXPECT = "(^.*Expect.*)"
private const val COMPANION_CONSTANT = "(^companionConstantChanged)"
internal val forK2 = listOf(
ALL_EXPECT, // KT-63125 - Partially related to single-module expect-actual tests, but regexp is really wide
MEMBER_ALIAS, // KT-55195 - Invalid for K2
COMPANION_CONSTANT // KT-56242 - Work in progress
).joinToString("|")
}
}
fun main(args: Array<String>) {
System.setProperty("java.awt.headless", "true")
generateTestGroupSuite(args) {
@@ -69,9 +85,7 @@ fun main(args: Array<String>) {
init = incrementalJvmTestData(
TargetBackend.JVM_IR,
folderToExcludePatternMap = mapOf(
PURE_KOTLIN to "(^.*Expect.*)"
+ "|(^removeMemberTypeAlias)|(^addMemberTypeAlias)" //KT-55195
+ "|(^companionConstantChanged)" //KT-56242
PURE_KOTLIN to ExcludePattern.forK2
)
)
)
@@ -80,9 +94,7 @@ fun main(args: Array<String>) {
init = incrementalJvmTestData(
TargetBackend.JVM_IR,
folderToExcludePatternMap = mapOf(
PURE_KOTLIN to "(^.*Expect.*)"
+ "|(^removeMemberTypeAlias)|(^addMemberTypeAlias)" //KT-55195
+ "|(^companionConstantChanged)", //KT-56242
PURE_KOTLIN to ExcludePattern.forK2,
WITH_JAVA to "^classToPackageFacade" // KT-56698
)
)
@@ -91,14 +103,12 @@ fun main(args: Array<String>) {
init = incrementalJvmTestData(
TargetBackend.JVM_IR,
folderToExcludePatternMap = mapOf(
PURE_KOTLIN to "(^.*Expect.*)"
+ "|(^removeMemberTypeAlias)|(^addMemberTypeAlias)" //KT-55195
+ "|(^companionConstantChanged)" //KT-56242
PURE_KOTLIN to ExcludePattern.forK2
)
)
)
testClass<AbstractIncrementalK1JsKlibCompilerRunnerTest>() {
testClass<AbstractIncrementalK1JsKlibCompilerRunnerTest> {
// IC of sealed interfaces are not supported in JS
model("incremental/pureKotlin", extension = null, recursive = false, excludedPattern = "(^sealed.*)|(.*SinceK2)")
model("incremental/classHierarchyAffected", extension = null, recursive = false)
@@ -124,16 +134,16 @@ fun main(args: Array<String>) {
// TODO: https://youtrack.jetbrains.com/issue/KT-61602/JS-K2-ICL-Fix-muted-tests
testClass<AbstractIncrementalK2JsKlibCompilerWithScopeExpansionRunnerTest> {
// IC of sealed interfaces are not supported in JS
model("incremental/pureKotlin", extension = null, recursive = false,
model(
"incremental/pureKotlin", extension = null, recursive = false,
// TODO: 'fileWithConstantRemoved' should be fixed in https://youtrack.jetbrains.com/issue/KT-58824
excludedPattern = "^(sealed.*|fileWithConstantRemoved|propertyRedeclaration|funRedeclaration|funVsConstructorOverloadConflict)"
)
model("incremental/classHierarchyAffected", extension = null, recursive = false,
model(
"incremental/classHierarchyAffected", extension = null, recursive = false,
excludedPattern = "secondaryConstructorAdded"
)
model("incremental/js", extension = null, excludeParentDirs = true)
//model("incremental/scopeExpansion", extension = null, excludeParentDirs = true)
}
testClass<AbstractIncrementalK1JsLegacyCompilerRunnerWithFriendModulesDisabledTest> {
@@ -142,11 +152,12 @@ fun main(args: Array<String>) {
testClass<AbstractIncrementalMultiplatformJvmCompilerRunnerTest> {
model("incremental/mpp/allPlatforms", extension = null, excludeParentDirs = true)
model("incremental/mpp/jvmOnly", extension = null, excludeParentDirs = true)
model("incremental/mpp/jvmOnlyK1", extension = null, excludeParentDirs = true)
}
testClass<AbstractIncrementalK1JsLegacyMultiplatformJsCompilerRunnerTest> {
model("incremental/mpp/allPlatforms", extension = null, excludeParentDirs = true)
}
//TODO: write a proper k2 multiplatform test runner KT-63183
}
testGroup(
@@ -34,5 +34,5 @@ Supported dependency flags:
- `runtime`
- `provided`
- `expectedBy` (old MPP)
- `included` (new MPP)
- `exproted`
- `include` (new MPP)
- `exported`
@@ -0,0 +1,2 @@
-language-version 1.9
-Xexpect-actual-classes
@@ -0,0 +1,2 @@
-language-version 1.9
-Xexpect-actual-classes
@@ -0,0 +1 @@
-language-version 1.9
@@ -0,0 +1,3 @@
-Xmulti-platform
-Xexpect-actual-classes
-language-version 1.9