diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2017-04-11 12:17:30 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2017-04-12 11:48:32 +0200 |
commit | bcdacee46f04f5bca4732bd487d3cc3c042e23db (patch) | |
tree | 69d3de19f61d91df9fb00cc9b86eed5da347a098 /compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala | |
parent | f891b224228f7c4939d09ac1849ad562d1298640 (diff) | |
download | dotty-bcdacee46f04f5bca4732bd487d3cc3c042e23db.tar.gz dotty-bcdacee46f04f5bca4732bd487d3cc3c042e23db.tar.bz2 dotty-bcdacee46f04f5bca4732bd487d3cc3c042e23db.zip |
Remove need for java written summary reporter
Diffstat (limited to 'compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala')
-rw-r--r-- | compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala b/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala index 476012d1d..ad068e9ef 100644 --- a/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala +++ b/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala @@ -43,7 +43,8 @@ trait RunnerOrchestration { def safeMode: Boolean /** Running a `Test` class's main method from the specified `dir` */ - def runMain(classPath: String): Status = monitor.runMain(classPath) + def runMain(classPath: String)(implicit summaryReport: SummaryReporting): Status = + monitor.runMain(classPath) private[this] val monitor = new RunnerMonitor @@ -57,7 +58,8 @@ trait RunnerOrchestration { */ private class RunnerMonitor { - def runMain(classPath: String): Status = withRunner(_.runMain(classPath)) + def runMain(classPath: String)(implicit summaryReport: SummaryReporting): Status = + withRunner(_.runMain(classPath)) private class Runner(private var process: Process) { private[this] var childStdout: BufferedReader = _ @@ -81,8 +83,16 @@ trait RunnerOrchestration { childStdin = null } + /** Did add hook to kill the child VMs? */ + private[this] var didAddCleanupCallback = false + /** Blocks less than `maxDuration` while running `Test.main` from `dir` */ - def runMain(classPath: String): Status = { + def runMain(classPath: String)(implicit summaryReport: SummaryReporting): Status = { + if (!didAddCleanupCallback) { + // If for some reason the test runner (i.e. sbt) doesn't kill the VM, we + // need to clean up ourselves. + summaryReport.addCleanup(killAll) + } assert(process ne null, "Runner was killed and then reused without setting a new process") @@ -127,9 +137,9 @@ trait RunnerOrchestration { // Handle failure of the VM: status match { case _: Success if safeMode => respawn() + case _: Success => // no need to respawn sub process case _: Failure => respawn() case Timeout => respawn() - case _ => () } status } @@ -182,8 +192,5 @@ trait RunnerOrchestration { // On shutdown, we need to kill all runners: sys.addShutdownHook(killAll()) - // If for some reason the test runner (i.e. sbt) doesn't kill the VM, we - // need to clean up ourselves. - SummaryReport.addCleanup(killAll) } } |