diff options
author | Philipp Haller <hallerp@gmail.com> | 2009-06-25 13:52:37 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2009-06-25 13:52:37 +0000 |
commit | ac7180cf635ac0e10064bf2f73f5012017601b9c (patch) | |
tree | 34038577af781200859fb3f801ce6343d9ee9450 | |
parent | c83d5573ce89787b69ed5abbdfbef78f4ba24f8b (diff) | |
download | scala-ac7180cf635ac0e10064bf2f73f5012017601b9c.tar.gz scala-ac7180cf635ac0e10064bf2f73f5012017601b9c.tar.bz2 scala-ac7180cf635ac0e10064bf2f73f5012017601b9c.zip |
Partest no longer hangs when reporting fails.
-rw-r--r-- | src/partest/scala/tools/partest/nest/DirectRunner.scala | 7 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/nest/Worker.scala | 38 |
2 files changed, 26 insertions, 19 deletions
diff --git a/src/partest/scala/tools/partest/nest/DirectRunner.scala b/src/partest/scala/tools/partest/nest/DirectRunner.scala index b4866c769e..898b795d93 100644 --- a/src/partest/scala/tools/partest/nest/DirectRunner.scala +++ b/src/partest/scala/tools/partest/nest/DirectRunner.scala @@ -12,7 +12,7 @@ import java.io.{File, PrintStream, FileOutputStream, BufferedReader, import java.util.StringTokenizer import scala.actors.Actor._ -import scala.actors.Scheduler +import scala.actors.{Scheduler, TIMEOUT} trait DirectRunner { @@ -57,12 +57,15 @@ trait DirectRunner { var logsToDelete: List[File] = List() var outdirsToDelete: List[File] = List() workers foreach { w => - receive { + receiveWithin(600 * 1000) { case Results(s, f, logs, outdirs) => logsToDelete = logsToDelete ::: logs.filter(_.toDelete) outdirsToDelete = outdirsToDelete ::: outdirs succs += s fails += f + case TIMEOUT => + // add at least one failure + fails += 1 } } logsToDelete.foreach { log => diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala index a01b9b0974..967374e6ee 100644 --- a/src/partest/scala/tools/partest/nest/Worker.scala +++ b/src/partest/scala/tools/partest/nest/Worker.scala @@ -881,28 +881,32 @@ class Worker(val fileManager: FileManager) extends Actor { } def reportResult(logs: Option[LogContext]) { - // delete log file only if test was successful - if (succeeded && !logs.isEmpty) - logs.get.file.toDelete = true - if (!succeeded) { errors += 1 NestUI.verbose("incremented errors: "+errors) } - if (!logs.isEmpty) - logs.get.writers match { - case Some((swr, wr)) => - printInfoEnd(succeeded, wr) - wr.flush() - swr.flush() - NestUI.normal(swr.toString) - if (!succeeded && fileManager.showDiff && diff != "") - NestUI.normal(diff) - if (!succeeded && fileManager.showLog) - showLog(logs.get.file) - case None => - } + try { + // delete log file only if test was successful + if (succeeded && !logs.isEmpty) + logs.get.file.toDelete = true + + if (!logs.isEmpty) + logs.get.writers match { + case Some((swr, wr)) => + printInfoEnd(succeeded, wr) + wr.flush() + swr.flush() + NestUI.normal(swr.toString) + if (!succeeded && fileManager.showDiff && diff != "") + NestUI.normal(diff) + if (!succeeded && fileManager.showLog) + showLog(logs.get.file) + case None => + } + } catch { + case npe: NullPointerException => + } } val numFiles = files.size |