[FIR Completion] Generate part of performance tests for FIR completion

This commit is contained in:
Roman Golyshev
2020-10-05 14:54:43 +03:00
parent beac3757bc
commit 0682084ca3
4 changed files with 1052 additions and 1 deletions
@@ -1050,6 +1050,12 @@ fun main(args: Array<String>) {
}
}
testGroup("idea/idea-fir-performance-tests/tests", "idea/idea-completion/testData") {
testClass<AbstractHighLevelPerformanceBasicCompletionHandlerTest> {
model("handlers/basic", testMethod = "doPerfTest", pattern = KT_WITHOUT_DOTS_IN_NAME)
}
}
testGroup("idea/idea-fir/tests", "idea/testData") {
testClass<AbstractFirReferenceResolveTest> {
model("resolve/references", pattern = KT_WITHOUT_DOTS_IN_NAME)
@@ -0,0 +1,27 @@
/*
* Copyright 2010-2019 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.idea.perf
import com.intellij.codeInsight.completion.CompletionType
import org.jetbrains.kotlin.idea.completion.FIR_COMPARISON
import org.jetbrains.kotlin.test.InTextDirectivesUtils
abstract class AbstractHighLevelPerformanceCompletionHandlerTests(
defaultCompletionType: CompletionType,
note: String = ""
) : AbstractPerformanceCompletionHandlerTests(defaultCompletionType, note) {
override val statsPrefix: String = "fir-completion"
override fun doPerfTest(unused: String) {
if (!InTextDirectivesUtils.isDirectiveDefined(testDataFile().readText(), FIR_COMPARISON)) return
super.doPerfTest(unused)
}
}
abstract class AbstractHighLevelPerformanceBasicCompletionHandlerTest :
AbstractHighLevelPerformanceCompletionHandlerTests(CompletionType.BASIC)
@@ -40,10 +40,12 @@ abstract class AbstractPerformanceCompletionHandlerTests(
val statsMap: MutableMap<String, Stats> = mutableMapOf()
}
protected open val statsPrefix = "completion"
private fun stats(): Stats {
val suffix = "${defaultCompletionType.toString().toLowerCase()}${if (note.isNotEmpty()) "-$note" else ""}"
return statsMap.computeIfAbsent(suffix) {
Stats("completion-$suffix")
Stats("$statsPrefix-$suffix")
}
}