Skip to content

Fix output of test compilation #5134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions compiler/test/dotty/tools/vulpix/ParallelTesting.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 -
Expand Down Expand Up @@ -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)
}
Expand All @@ -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) {
Expand Down