[Test] Extract main compiler test generator to separate project

This is needed because now we have different tests modules with different
  test frameworks (JUnit3 and JUnit5) which has no dependencies between
  each other. So for keeping all test generation config in one place
  we need module which may rely on all independent test modules
This commit is contained in:
Dmitriy Novozhilov
2020-12-18 12:33:40 +03:00
committed by TeamCityServer
parent d753d21dee
commit 1f258c28fc
12 changed files with 70 additions and 29 deletions
+3 -5
View File
@@ -17,9 +17,9 @@ dependencies {
testImplementation(projectTests(":generators:test-generator"))
testImplementation(platform("org.junit:junit-bom:5.7.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.junit.platform:junit-platform-commons:1.7.0")
testApi(platform("org.junit:junit-bom:5.7.0"))
testApi("org.junit.jupiter:junit-jupiter")
testApi("org.junit.platform:junit-platform-commons:1.7.0")
testApi(projectTests(":compiler:test-infrastructure"))
testImplementation(projectTests(":compiler:test-infrastructure-utils"))
testImplementation(projectTests(":compiler:tests-compiler-utils"))
@@ -88,5 +88,3 @@ projectTest(parallel = true, jUnit5Enabled = true) {
}
testsJar()
val generateTests by generator("org.jetbrains.kotlin.test.generators.GenerateNewCompilerTestsKt")
@@ -1,61 +0,0 @@
/*
* Copyright 2010-2020 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.generators
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_WITHOUT_DOTS_IN_NAME
import org.jetbrains.kotlin.test.TargetBackend
import org.jetbrains.kotlin.test.runners.*
fun main(args: Array<String>) {
val excludedFirTestdataPattern = "^(.+)\\.fir\\.kts?\$"
generateNewTestGroupSuite(args) {
testGroup("compiler/tests-common-new/tests-gen", "compiler/testData") {
testClass<AbstractDiagnosticTest> {
model("diagnostics/tests", pattern = "^(.*)\\.kts?$", excludedPattern = excludedFirTestdataPattern)
model("diagnostics/testsWithStdLib", excludedPattern = excludedFirTestdataPattern)
}
testClass<AbstractDiagnosticUsingJavacTest> {
model("diagnostics/tests/javac", pattern = "^(.*)\\.kts?$", excludedPattern = excludedFirTestdataPattern)
}
testClass<AbstractFirDiagnosticTest>(suiteTestClassName = "FirOldFrontendDiagnosticsTestGenerated") {
model("diagnostics/tests", excludedPattern = excludedFirTestdataPattern)
model("diagnostics/testsWithStdLib", excludedPattern = excludedFirTestdataPattern)
}
testClass<AbstractDiagnosticsTestWithJsStdLib> {
model("diagnostics/testsWithJsStdLib")
}
testClass<AbstractDiagnosticsTestWithOldJvmBackend> {
model("diagnostics/testsWithJvmBackend", targetBackend = TargetBackend.JVM_OLD)
}
testClass<AbstractDiagnosticsTestWithJvmIrBackend> {
model("diagnostics/testsWithJvmBackend", targetBackend = TargetBackend.JVM_IR)
}
testClass<AbstractDiagnosticsNativeTest> {
model("diagnostics/nativeTests")
}
}
testGroup("compiler/tests-common-new/tests-gen", "compiler/fir/analysis-tests/testData") {
testClass<AbstractFirDiagnosticTest> {
model("resolve", pattern = KT_WITHOUT_DOTS_IN_NAME)
model("resolveWithStdlib", pattern = KT_WITHOUT_DOTS_IN_NAME)
}
testClass<AbstractFirDiagnosticsWithLightTreeTest> {
model("resolve", pattern = KT_WITHOUT_DOTS_IN_NAME)
}
}
}
}
const val TEST_GENERATOR_NAME = "GenerateNewCompilerTests.kt"
@@ -9,14 +9,14 @@ import org.jetbrains.kotlin.generators.InconsistencyChecker
import org.jetbrains.kotlin.generators.TestGroupSuite
import org.jetbrains.kotlin.generators.testGroupSuite
fun generateNewTestGroupSuite(
fun generateTestGroupSuiteWithJUnit5(
args: Array<String>,
init: TestGroupSuite.() -> Unit
) {
generateNewTestGroupSuite(InconsistencyChecker.hasDryRunArg(args), init)
generateTestGroupSuiteWithJUnit5(InconsistencyChecker.hasDryRunArg(args), init)
}
fun generateNewTestGroupSuite(
fun generateTestGroupSuiteWithJUnit5(
dryRun: Boolean = false,
init: TestGroupSuite.() -> Unit
) {
@@ -22,6 +22,8 @@ import java.io.File
import java.io.IOException
import java.util.*
private const val TEST_GENERATOR_NAME = "GenerateNewCompilerTests.kt"
private val METHOD_GENERATORS = listOf(
SimpleTestClassModelTestAllFilesPresentMethodGenerator,
SimpleTestMethodGenerator,