[FIR] Move reporting of errors in modularized tests in separate log file
This commit is contained in:
+8
-5
@@ -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()
|
||||
|
||||
@@ -319,19 +319,20 @@ fun <T> Collection<T>.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)")
|
||||
|
||||
Reference in New Issue
Block a user