Add prefix for inner test classes in ide perf tests to avoid metric name clashes

This commit is contained in:
Vladimir Dolzhenko
2020-10-25 22:48:56 +01:00
parent 08b8939b80
commit 0a18be62e5
2 changed files with 14 additions and 2 deletions
@@ -34,6 +34,16 @@ abstract class AbstractPerformanceTypingIndentationTest : KotlinLightCodeInsight
).run()
}
private fun testName(): String {
val javaClass = this.javaClass
val testName = getTestName(false)
return if (javaClass.isMemberClass) {
"${javaClass.simpleName} - $testName"
} else {
testName
}
}
protected fun doPerfTest(unused: String) {
val testName = getTestName(false)
@@ -50,7 +60,7 @@ abstract class AbstractPerformanceTypingIndentationTest : KotlinLightCodeInsight
configurator.configureSettings()
performanceTest<Unit, Unit> {
name(testName)
name(testName())
stats(stats)
warmUpIterations(20)
iterations(30)
@@ -49,8 +49,10 @@ data class Benchmark(
metrics.forEach { it.resetValue() }
}
private fun String?.escapeName() = this?.replace(Regex("[^A-Za-z0-9_]"), "_")
fun fileName(): String =
listOfNotNull(benchmark, name?.replace("[^A-Za-z0-9_]", ""), buildId?.toString()).joinToString(separator = "_")
listOfNotNull(benchmark?.escapeName(), name?.escapeName(), buildId?.toString()).joinToString(separator = "_")
fun cleanUp() {
metrics?.forEach { it.cleanUp() }