Adding automated parametrized tests for all jps-plugin tests
KT-8487
This commit is contained in:
committed by
Alexey Tsvetkov
parent
7b54751092
commit
c5617f1274
+56
@@ -0,0 +1,56 @@
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.Parameterized
|
||||
import java.io.File
|
||||
|
||||
@Ignore
|
||||
@RunWith(Parameterized::class)
|
||||
class KotlinGradlePluginJpsParametrizedIT : BaseIncrementalGradleIT() {
|
||||
|
||||
@Parameterized.Parameter
|
||||
@JvmField
|
||||
var relativePath: String = ""
|
||||
|
||||
@Test
|
||||
fun testFromJps() {
|
||||
try {
|
||||
JpsTestProject(jpsResourcesPath, relativePath).performAndAssertBuildStages()
|
||||
}
|
||||
finally {
|
||||
if (defaultBuildOptions().withDaemon)
|
||||
checkRecycleDaemon()
|
||||
}
|
||||
}
|
||||
|
||||
override fun defaultBuildOptions(): BuildOptions = BuildOptions(withDaemon = true)
|
||||
|
||||
companion object {
|
||||
|
||||
private val jpsResourcesPath = File("../../../jps-plugin/testData/incremental")
|
||||
|
||||
val MAX_TESTS_ON_SINGLE_DAEMON = 20
|
||||
private var testsCounter = 0
|
||||
|
||||
@Suppress("unused")
|
||||
@Parameterized.Parameters(name = "{index}: {0}")
|
||||
@JvmStatic
|
||||
fun data(): List<Array<String>> =
|
||||
jpsResourcesPath.walk()
|
||||
.filter { it.isDirectory && isJpsTestProject(it) }
|
||||
.map { arrayOf(it.toRelativeString(jpsResourcesPath)) }
|
||||
.toList()
|
||||
// .take(30)
|
||||
|
||||
@Synchronized
|
||||
fun checkRecycleDaemon() {
|
||||
if (testsCounter++ > MAX_TESTS_ON_SINGLE_DAEMON) {
|
||||
BaseGradleIT.tearDownAll()
|
||||
testsCounter = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user