-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #5116: make it easy to sequentially run test #5120
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
Conversation
With this change, it suffices to use `1` to make all tests sequential: val pool = threadLimit match { case Some(i) => JExecutors.newWorkStealingPool(1) case None => JExecutors.newWorkStealingPool(1) } Previously, `1` doesn't work because the progress bar monopolizes one thread in the thread pool.
/** A single `Runnable` that prints a progress bar for the curent `Test` */ | ||
private def createProgressMonitor: Runnable = () => { | ||
/** A `TimerTask` that prints a progress bar for the curent `Test` */ | ||
private def updateProgressMonitor: Unit = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side effectful, so def updateProgressMonitor()
@@ -479,6 +484,10 @@ trait ParallelTesting extends RunnerOrchestration { self => | |||
throw new TimeoutException("Compiling targets timed out") | |||
} | |||
|
|||
// wait for the timer task to execute once | |||
Thread.sleep(300) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just call updateProgressMonitor()
and not wait
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it should probably go after eventualResults.foreach(_.get)
@@ -481,6 +486,10 @@ trait ParallelTesting extends RunnerOrchestration { self => | |||
|
|||
eventualResults.foreach(_.get) | |||
|
|||
// update progress one last time | |||
updateProgressMonitor() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would cancel the timer first to make sure there is no concurrent call to updateProgressMonitor
.
Also it should only be called if isInteractive && !suppressAllOutput
is true
. I suggest something like:
val logProgress = isInteractive && !suppressAllOutput
if (logProgress) {
val task = new TimerTask {
def run() = updateProgressMonitor()
}
timer.schedule(task, 100, 200)
}
...
if (logProgress) {
timer.cancel()
// update progress one last time
updateProgressMonitor()
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM
Fix #5116: make it easy to sequentially run test
With this change, it suffices to use
1
to make all tests sequential:Previously,
1
doesn't work because the progress bar monopolizes one threadin the thread pool.