[FIR] Move reporting of errors in modularized tests in separate log file

This commit is contained in:
Dmitriy Novozhilov
2019-09-12 10:32:38 +03:00
parent 5dc29b9059
commit c2180b9361
2 changed files with 17 additions and 13 deletions
@@ -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()