Add the possibility to mute Gradle IC tests by folder
If you need to mute a test for Gradle IC, the only way is to add exclude pattern and regenerate tests aka remove unnecessary tests. But the filter is absolute, so if you have the same test name in different subfolders (e.g. `pureKotlin/classRemoved/` and `classHierarchyAffected/classRemoved`) you cannot disable only one of them. This commit adds logic to specify which name pattern in which subfolder should be excluded
This commit is contained in:
committed by
Space Team
parent
1c055b3b23
commit
f640a7be2e
+1
-1
@@ -59,7 +59,7 @@ public class IncrementalFirICLightTreeJvmCompilerRunnerTestGenerated extends Abs
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPureKotlin() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile("^.*Expect.*"), TargetBackend.JVM_IR, false);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile("(^.*Expect.*)"), TargetBackend.JVM_IR, false);
|
||||
}
|
||||
|
||||
@TestMetadata("annotations")
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ public class IncrementalFirJvmCompilerRunnerTestGenerated extends AbstractIncrem
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPureKotlin() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile("^.*Expect.*"), TargetBackend.JVM_IR, false);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile("(^.*Expect.*)"), TargetBackend.JVM_IR, false);
|
||||
}
|
||||
|
||||
@TestMetadata("annotations")
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ public class IncrementalFirLightTreeJvmCompilerRunnerTestGenerated extends Abstr
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPureKotlin() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile("^.*Expect.*"), TargetBackend.JVM_IR, false);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile("(^.*Expect.*)"), TargetBackend.JVM_IR, false);
|
||||
}
|
||||
|
||||
@TestMetadata("annotations")
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ public class IncrementalJvmCompilerRunnerTestGenerated extends AbstractIncrement
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPureKotlin() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile(".*SinceK2"), TargetBackend.JVM_IR, false);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile("(.*SinceK2)"), TargetBackend.JVM_IR, false);
|
||||
}
|
||||
|
||||
@TestMetadata("annotations")
|
||||
|
||||
@@ -20,10 +20,11 @@ import org.jetbrains.kotlin.assignment.plugin.AbstractIrBlackBoxCodegenTestAssig
|
||||
import org.jetbrains.kotlin.assignment.plugin.AbstractAssignmentPluginDiagnosticTest
|
||||
import org.jetbrains.kotlin.fir.plugin.runners.AbstractFirPluginBlackBoxCodegenTest
|
||||
import org.jetbrains.kotlin.fir.plugin.runners.AbstractFirPluginDiagnosticTest
|
||||
import org.jetbrains.kotlin.generators.TestGroup
|
||||
import org.jetbrains.kotlin.generators.generateTestGroupSuiteWithJUnit5
|
||||
import org.jetbrains.kotlin.generators.impl.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.generators.model.annotation
|
||||
import org.jetbrains.kotlin.generators.tests.IncrementalTestsGeneratorUtil.Companion.IcTestTypes.*
|
||||
import org.jetbrains.kotlin.generators.tests.IncrementalTestsGeneratorUtil.Companion.incrementalJvmTestData
|
||||
import org.jetbrains.kotlin.incremental.*
|
||||
import org.jetbrains.kotlin.jvm.abi.*
|
||||
import org.jetbrains.kotlin.kapt.cli.test.AbstractArgumentParsingTest
|
||||
@@ -45,41 +46,29 @@ fun main(args: Array<String>) {
|
||||
System.setProperty("java.awt.headless", "true")
|
||||
generateTestGroupSuite(args) {
|
||||
testGroup("compiler/incremental-compilation-impl/test", "jps/jps-plugin/testData") {
|
||||
fun incrementalJvmTestData(targetBackend: TargetBackend, excludePattern: String? = null): TestGroup.TestClass.() -> Unit = {
|
||||
model(
|
||||
"incremental/pureKotlin",
|
||||
extension = null,
|
||||
recursive = false,
|
||||
targetBackend = targetBackend,
|
||||
excludedPattern = excludePattern
|
||||
)
|
||||
model("incremental/classHierarchyAffected", extension = null, recursive = false, targetBackend = targetBackend)
|
||||
model("incremental/inlineFunCallSite", extension = null, excludeParentDirs = true, targetBackend = targetBackend)
|
||||
model("incremental/withJava", extension = null, excludeParentDirs = true, targetBackend = targetBackend)
|
||||
model("incremental/incrementalJvmCompilerOnly", extension = null, excludeParentDirs = true, targetBackend = targetBackend)
|
||||
}
|
||||
testClass<AbstractIncrementalJvmCompilerRunnerTest>(
|
||||
init = incrementalJvmTestData(
|
||||
targetBackend = TargetBackend.JVM_IR,
|
||||
excludePattern = ".*SinceK2"
|
||||
folderToExcludePatternMap = mapOf(PURE_KOTLIN to ".*SinceK2")
|
||||
)
|
||||
)
|
||||
|
||||
testClass<AbstractIncrementalFirJvmCompilerRunnerTest>(
|
||||
init = incrementalJvmTestData(
|
||||
TargetBackend.JVM_IR,
|
||||
excludePattern = "^.*Expect.*"
|
||||
folderToExcludePatternMap = mapOf(PURE_KOTLIN to "^.*Expect.*")
|
||||
)
|
||||
)
|
||||
testClass<AbstractIncrementalFirICLightTreeJvmCompilerRunnerTest>(
|
||||
init = incrementalJvmTestData(
|
||||
TargetBackend.JVM_IR,
|
||||
excludePattern = "^.*Expect.*"
|
||||
folderToExcludePatternMap = mapOf(PURE_KOTLIN to "^.*Expect.*")
|
||||
)
|
||||
)
|
||||
testClass<AbstractIncrementalFirLightTreeJvmCompilerRunnerTest>(
|
||||
init = incrementalJvmTestData(
|
||||
TargetBackend.JVM_IR,
|
||||
excludePattern = "^.*Expect.*"
|
||||
folderToExcludePatternMap = mapOf(PURE_KOTLIN to "^.*Expect.*")
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright 2010-2023 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.generators.tests
|
||||
|
||||
import org.jetbrains.kotlin.generators.TestGroup
|
||||
import org.jetbrains.kotlin.generators.tests.IncrementalTestsGeneratorUtil.Companion.IcTestTypes.*
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
|
||||
class IncrementalTestsGeneratorUtil {
|
||||
companion object {
|
||||
enum class IcTestTypes(val folderName: String) {
|
||||
ALL("all"),
|
||||
PURE_KOTLIN("pureKotlin"),
|
||||
CLASS_HIERARCHY_AFFECTED("classHierarchyAffected"),
|
||||
INLINE_FUN_CALL_SITE("inlineFunCallSite"),
|
||||
WITH_JAVA("withJava"),
|
||||
INCREMENTAL_JVM_COMPILER_ONLY("incrementalJvmCompilerOnly")
|
||||
}
|
||||
|
||||
private fun buildExcludePattern(excludePatterns: List<String>): String? =
|
||||
excludePatterns.joinToString("|") { "($it)" }.ifBlank { null }
|
||||
|
||||
fun incrementalJvmTestData(
|
||||
targetBackend: TargetBackend,
|
||||
folderToExcludePatternMap: Map<IcTestTypes, String>? = null
|
||||
): TestGroup.TestClass.() -> Unit = {
|
||||
val excludeForAllTestData = folderToExcludePatternMap?.get(ALL)
|
||||
model(
|
||||
"incremental/${PURE_KOTLIN.folderName}",
|
||||
extension = null,
|
||||
recursive = false,
|
||||
targetBackend = targetBackend,
|
||||
excludedPattern = buildExcludePattern(listOfNotNull(folderToExcludePatternMap?.get(PURE_KOTLIN), excludeForAllTestData))
|
||||
)
|
||||
model(
|
||||
"incremental/${CLASS_HIERARCHY_AFFECTED.folderName}",
|
||||
extension = null,
|
||||
recursive = false,
|
||||
targetBackend = targetBackend,
|
||||
excludedPattern = buildExcludePattern(
|
||||
listOfNotNull(
|
||||
folderToExcludePatternMap?.get(CLASS_HIERARCHY_AFFECTED),
|
||||
excludeForAllTestData
|
||||
)
|
||||
)
|
||||
)
|
||||
model(
|
||||
"incremental/${INLINE_FUN_CALL_SITE.folderName}",
|
||||
extension = null,
|
||||
excludeParentDirs = true,
|
||||
targetBackend = targetBackend,
|
||||
excludedPattern = buildExcludePattern(
|
||||
listOfNotNull(
|
||||
folderToExcludePatternMap?.get(INLINE_FUN_CALL_SITE),
|
||||
excludeForAllTestData
|
||||
)
|
||||
)
|
||||
)
|
||||
model(
|
||||
"incremental/${WITH_JAVA.folderName}",
|
||||
extension = null,
|
||||
excludeParentDirs = true,
|
||||
targetBackend = targetBackend,
|
||||
excludedPattern = buildExcludePattern(listOfNotNull(folderToExcludePatternMap?.get(WITH_JAVA), excludeForAllTestData))
|
||||
)
|
||||
model(
|
||||
"incremental/${INCREMENTAL_JVM_COMPILER_ONLY.folderName}",
|
||||
extension = null,
|
||||
excludeParentDirs = true,
|
||||
targetBackend = targetBackend,
|
||||
excludedPattern = buildExcludePattern(
|
||||
listOfNotNull(
|
||||
folderToExcludePatternMap?.get(INCREMENTAL_JVM_COMPILER_ONLY),
|
||||
excludeForAllTestData
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user