Skip to content

Commit 20ad4a0

Browse files
authored
Merge pull request #5134 from dotty-staging/fix-testCompilation-output
Fix output of test compilation
2 parents d1f7a11 + aa69a9f commit 20ad4a0

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

compiler/test/dotty/tools/vulpix/ParallelTesting.scala

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,9 @@ trait ParallelTesting extends RunnerOrchestration { self =>
286286
realStderr.println(msg + paddingRight)
287287
}
288288

289-
/** Print a progress bar for the curent `Test` */
290-
private def updateProgressMonitor(): Unit = {
291-
val start = System.currentTimeMillis
292-
var tCompiled = testSourcesCompleted
289+
/** Print a progress bar for the current `Test` */
290+
private def updateProgressMonitor(start: Long): Unit = {
291+
val tCompiled = testSourcesCompleted
293292
if (tCompiled < sourceCount) {
294293
val timestamp = (System.currentTimeMillis - start) / 1000
295294
val progress = (tCompiled.toDouble / sourceCount * 40).toInt
@@ -301,13 +300,6 @@ trait ParallelTesting extends RunnerOrchestration { self =>
301300
s"] completed ($tCompiled/$sourceCount, $failureCount failed, ${timestamp}s)\r"
302301
)
303302
}
304-
else {
305-
val timestamp = (System.currentTimeMillis - start) / 1000
306-
// println, otherwise no newline and cursor at start of line
307-
realStdout.print(
308-
s"[=======================================] completed ($sourceCount/$sourceCount, $failureCount failed, ${timestamp}s)\r"
309-
)
310-
}
311303
}
312304

313305
/** Wrapper function to make sure that the compiler itself did not crash -
@@ -466,9 +458,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
466458

467459
val timer = new Timer()
468460
val logProgress = isInteractive && !suppressAllOutput
461+
val start = System.currentTimeMillis()
469462
if (logProgress) {
470463
val task = new TimerTask {
471-
def run() = updateProgressMonitor()
464+
def run(): Unit = updateProgressMonitor(start)
472465
}
473466
timer.schedule(task, 100, 200)
474467
}
@@ -489,8 +482,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
489482

490483
if (logProgress) {
491484
timer.cancel()
492-
// update progress one last time
493-
updateProgressMonitor()
485+
val timestamp = (System.currentTimeMillis - start) / 1000
486+
realStdout.println(
487+
s"[=======================================] completed ($sourceCount/$sourceCount, $failureCount failed, ${timestamp}s)"
488+
)
494489
}
495490

496491
if (didFail) {

0 commit comments

Comments
 (0)