From aa69a9f681815a3f7e2d2f077cfac1dcb253bffa Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Fri, 21 Sep 2018 14:04:26 +0200 Subject: [PATCH] Fix output of test compilation Previously the completed progressbar was removed when the tests finished and the timestamp was always `0s`. --- .../dotty/tools/vulpix/ParallelTesting.scala | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala index c42e1073c237..0b2325ee549a 100644 --- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala +++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala @@ -286,10 +286,9 @@ trait ParallelTesting extends RunnerOrchestration { self => realStderr.println(msg + paddingRight) } - /** Print a progress bar for the curent `Test` */ - private def updateProgressMonitor(): Unit = { - val start = System.currentTimeMillis - var tCompiled = testSourcesCompleted + /** Print a progress bar for the current `Test` */ + private def updateProgressMonitor(start: Long): Unit = { + val tCompiled = testSourcesCompleted if (tCompiled < sourceCount) { val timestamp = (System.currentTimeMillis - start) / 1000 val progress = (tCompiled.toDouble / sourceCount * 40).toInt @@ -301,13 +300,6 @@ trait ParallelTesting extends RunnerOrchestration { self => s"] completed ($tCompiled/$sourceCount, $failureCount failed, ${timestamp}s)\r" ) } - else { - val timestamp = (System.currentTimeMillis - start) / 1000 - // println, otherwise no newline and cursor at start of line - realStdout.print( - s"[=======================================] completed ($sourceCount/$sourceCount, $failureCount failed, ${timestamp}s)\r" - ) - } } /** Wrapper function to make sure that the compiler itself did not crash - @@ -466,9 +458,10 @@ trait ParallelTesting extends RunnerOrchestration { self => val timer = new Timer() val logProgress = isInteractive && !suppressAllOutput + val start = System.currentTimeMillis() if (logProgress) { val task = new TimerTask { - def run() = updateProgressMonitor() + def run(): Unit = updateProgressMonitor(start) } timer.schedule(task, 100, 200) } @@ -489,8 +482,10 @@ trait ParallelTesting extends RunnerOrchestration { self => if (logProgress) { timer.cancel() - // update progress one last time - updateProgressMonitor() + val timestamp = (System.currentTimeMillis - start) / 1000 + realStdout.println( + s"[=======================================] completed ($sourceCount/$sourceCount, $failureCount failed, ${timestamp}s)" + ) } if (didFail) {