diff --git a/compiler/fir/modularized-tests/tests/org/jetbrains/kotlin/fir/FirResolveModularizedTotalKotlinTest.kt b/compiler/fir/modularized-tests/tests/org/jetbrains/kotlin/fir/FirResolveModularizedTotalKotlinTest.kt index 48b88584fdd..7ec65ac581e 100644 --- a/compiler/fir/modularized-tests/tests/org/jetbrains/kotlin/fir/FirResolveModularizedTotalKotlinTest.kt +++ b/compiler/fir/modularized-tests/tests/org/jetbrains/kotlin/fir/FirResolveModularizedTotalKotlinTest.kt @@ -129,7 +129,7 @@ class FirResolveModularizedTotalKotlinTest : AbstractModularizedTest() { override fun afterPass(pass: Int) { val statistics = bench.getTotalStatistics() - statistics.report(System.out, "Pass $pass", errorTypeReports = false) + statistics.report(System.out, "Pass $pass") saveReport(pass, statistics) if (statistics.totalTime < (bestStatistics?.totalTime ?: Long.MAX_VALUE)) { @@ -143,7 +143,8 @@ class FirResolveModularizedTotalKotlinTest : AbstractModularizedTest() { override fun afterAllPasses() { val bestStatistics = bestStatistics ?: return - printStatistics(bestStatistics, "Best pass: $bestPass", false) + printStatistics(bestStatistics, "Best pass: $bestPass") + printErrors(bestStatistics) } private val folderDateFormat = SimpleDateFormat("yyyy-MM-dd") @@ -169,15 +170,17 @@ class FirResolveModularizedTotalKotlinTest : AbstractModularizedTest() { printStatistics(statistics, "PASS $pass") } - private fun printStatistics(statistics: FirResolveBench.TotalStatistics, header: String, errorTypeReports: Boolean = true) { + private fun printErrors(statistics: FirResolveBench.TotalStatistics) { + PrintStream(FileOutputStream(reportDir().resolve("errors-$reportDateStr.log"), true)).use(statistics::reportErrors) + } + + private fun printStatistics(statistics: FirResolveBench.TotalStatistics, header: String) { PrintStream( FileOutputStream( reportDir().resolve("report-$reportDateStr.log"), true ) ).use { stream -> - val sep = "=".repeat(10) - stream.println("$sep $header $sep") statistics.report(stream, header) stream.println() stream.println() diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveBench.kt b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveBench.kt index 737b19dd2a3..3e941f47136 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveBench.kt +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveBench.kt @@ -319,19 +319,20 @@ fun Collection.progress(step: Double = 0.1, computeLabel: (T) -> String): } } -fun FirResolveBench.TotalStatistics.report(stream: PrintStream, header: String, errorTypeReports: Boolean = true) { - with(stream) { - if (errorTypeReports) - errorTypesReports.values.sortedByDescending { it.count }.forEach { - print("${it.count}:") - println(it.report) - } +fun FirResolveBench.TotalStatistics.reportErrors(stream: PrintStream) { + errorTypesReports.values.sortedByDescending { it.count }.forEach { + stream.print("${it.count}:") + stream.println(it.report) + } +} +fun FirResolveBench.TotalStatistics.report(stream: PrintStream, header: String) { + with(stream) { infix fun Int.percentOf(other: Int): String { return String.format("%.1f%%", this * 100.0 / other) } println() - println("---------- $header ----------") + println("========== $header ==========") println("Unresolved (untouched) implicit types: $unresolvedTypes (${unresolvedTypes percentOf totalTypes})") println("Resolved types: $resolvedTypes (${resolvedTypes percentOf totalTypes})") println("Correctly resolved types: $goodTypes (${goodTypes percentOf resolvedTypes} of resolved)")