[FIR] Make test fail if profiling requested, but misconfigured

This commit is contained in:
Simon Ogorodnik
2020-08-17 17:18:16 +03:00
parent 15d4333e81
commit 38477be484
@@ -56,18 +56,22 @@ class FirResolveModularizedTotalKotlinTest : AbstractModularizedTest() {
private var bestStatistics: FirResolveBench.TotalStatistics? = null private var bestStatistics: FirResolveBench.TotalStatistics? = null
private var bestPass: Int = 0 private var bestPass: Int = 0
private val asyncProfiler = try { private val asyncProfiler = if (ASYNC_PROFILER_LIB != null) {
if (ASYNC_PROFILER_LIB != null) { try {
AsyncProfilerHelper.getInstance(ASYNC_PROFILER_LIB) AsyncProfilerHelper.getInstance(ASYNC_PROFILER_LIB)
} else { } catch (e: ExceptionInInitializerError) {
null if (e.cause is ClassNotFoundException) {
throw IllegalStateException("Async-profiler initialization error, make sure async-profiler.jar is on classpath", e.cause)
}
throw e
} }
} catch (_: Throwable) { } else {
null null
} }
private fun executeAsyncProfilerCommand(command: String, pass: Int) { private fun executeAsyncProfilerCommand(command: String?, pass: Int) {
if (asyncProfiler != null) { if (asyncProfiler != null) {
require(command != null)
fun String.replaceParams(): String = fun String.replaceParams(): String =
this.replace("\$REPORT_DATE", reportDateStr) this.replace("\$REPORT_DATE", reportDateStr)
.replace("\$PASS", pass.toString()) .replace("\$PASS", pass.toString())