Permalink
Browse files

Modify forking tests based on Stefan's feedback. Should be ported to …

…0.12
  • Loading branch information...
1 parent 9414f98 commit 04d53c05d56dfcd0d73eea4a5038f6d737781a25 Eugene Vigdorchik committed with May 9, 2012
Showing with 7 additions and 9 deletions.
  1. +6 −8 main/actions/ForkTests.scala
  2. +1 −1 testing/agent/src/main/java/sbt/ForkMain.java
View
14 main/actions/ForkTests.scala
@@ -50,15 +50,13 @@ private[sbt] object ForkTests {
case Array(`Info`, s: String) => log.info(s); react
case Array(`Debug`, s: String) => log.debug(s); react
case t: Throwable => log.trace(t); react
- case tEvents: Array[Event] =>
- for (first <- tEvents.headOption) listeners.foreach(_ startGroup first.testName)
+ case Array(group: String, tEvents: Array[Event]) =>
+ listeners.foreach(_ startGroup group)
val event = TestEvent(tEvents)
listeners.foreach(_ testEvent event)
- for (first <- tEvents.headOption) {
- val result = event.result getOrElse TestResult.Passed
- results += first.testName -> result
- listeners.foreach(_ endGroup (first.testName, result))
- }
+ val result = event.result getOrElse TestResult.Passed
+ results += group -> result
+ listeners.foreach(_ endGroup (group, result))
react
}
@@ -89,7 +87,7 @@ private[sbt] object ForkTests {
val fullCp = classpath ++: Seq(IO.classLocationFile[ForkMain], IO.classLocationFile[Framework])
val options = javaOpts ++: Seq("-classpath", fullCp mkString File.pathSeparator, classOf[ForkMain].getCanonicalName, server.getLocalPort.toString)
- val ec = Fork.java(javaHome, options, LoggedOutput(log))
+ val ec = Fork.java(javaHome, options, StdoutOutput)
if (ec != 0) log.error("Running java with options " + options.mkString(" ") + " failed with exit code " + ec)
} finally {
server.close()
View
2 testing/agent/src/main/java/sbt/ForkMain.java
@@ -137,7 +137,7 @@ void run(ObjectInputStream is, final ObjectOutputStream os) throws Exception {
} else {
write(os, new Object[]{ForkTags.Error, "Framework '" + framework + "' does not support test '" + test.name + "'"});
}
- write(os, events.toArray(new ForkEvent[events.size()]));
+ write(os, new Object[]{test.name, events.toArray(new ForkEvent[events.size()])});
}
}
write(os, ForkTags.Done);

0 comments on commit 04d53c0

Please sign in to comment.