Add Gradle test task to run Gradle and Kotlin daemon tests.

These tests could not run in parallel, as they could not share
Gradle or Kotlin daemons with other running in parallel tests.

^KT-45745 In Progress
This commit is contained in:
Yahor Berdnikau
2021-06-27 21:35:54 +02:00
parent c8fa8b0444
commit 87dd357ec6
2 changed files with 24 additions and 13 deletions
@@ -172,9 +172,23 @@ val simpleTestsTask = tasks.register<Test>("kgpSimpleTests") {
}
}
// Daemon tests could run only sequentially as they could not be shared between parallel test builds
val daemonsTestsTask = tasks.register<Test>("kgpDaemonTests") {
group = KGP_TEST_TASKS_GROUP
description = "Run only Gradle and Kotlin daemon tests for Kotlin Gradle Plugin"
maxParallelForks = 1
mustRunAfter(simpleTestsTask)
useJUnitPlatform {
includeTags("DaemonsKGP")
includeEngines("junit-jupiter")
}
}
tasks.named<Task>("check") {
dependsOn("testAdvanceGradleVersion")
dependsOn(simpleTestsTask)
dependsOn(simpleTestsTask, daemonsTestsTask)
if (isTeamcityBuild) {
dependsOn("testAdvanceGradleVersionMppAndAndroid")
dependsOn("testMppAndAndroid")
@@ -184,17 +198,6 @@ tasks.named<Task>("check") {
}
}
val kgpJunit5Tests = tasks.register<Test>("kgpJunit5Tests") {
group = KGP_TEST_TASKS_GROUP
description = "Run only JUnit 5 tests for Kotlin Gradle Plugin"
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 4).coerceAtLeast(1)
useJUnitPlatform {
includeTags("JUnit5")
includeEngines("junit-jupiter")
}
}
tasks.withType<KotlinCompile> {
kotlinOptions.jdkHome = rootProject.extra["JDK_18"] as String
kotlinOptions.jvmTarget = "1.8"
@@ -224,7 +227,7 @@ tasks.withType<Test> {
val shouldApplyJunitPlatform = name !in setOf(
simpleTestsTask.name,
kgpJunit5Tests.name
daemonsTestsTask.name
)
if (shouldApplyJunitPlatform) {
maxHeapSize = "512m"
@@ -14,3 +14,11 @@ import org.junit.jupiter.api.Tag
@Retention(AnnotationRetention.RUNTIME)
@Tag("SimpleKGP")
annotation class SimpleGradlePluginTests
/**
* Add it to test classes performing Gradle or Kotlin daemon checks.
*/
@Target(AnnotationTarget.CLASS, AnnotationTarget.ANNOTATION_CLASS)
@Retention(AnnotationRetention.RUNTIME)
@Tag("DaemonsKGP")
annotation class DaemonsGradlePluginTests