diff --git a/main/Defaults.scala b/main/Defaults.scala index 00ec1437a..3e0550ead 100755 --- a/main/Defaults.scala +++ b/main/Defaults.scala @@ -118,7 +118,7 @@ object Defaults extends BuildCommon pomIncludeRepository :== Classpaths.defaultRepositoryFilter )) def defaultTestTasks(key: Scoped): Seq[Setting[_]] = Seq( - tags in key := Seq(Tags.Test -> 1), + tags in key := Seq(Tags.Test -> 1, Tags.Subprocess -> 1), logBuffered in key := true ) def projectCore: Seq[Setting[_]] = Seq( @@ -288,7 +288,7 @@ object Defaults extends BuildCommon testFilter in testQuick <<= testQuickFilter, executeTests <<= (streams in test, loadedTestFrameworks, testLoader, testGrouping in test, fullClasspath in test, javaOptions in test, javaHome in test) flatMap { (s, frameworkMap, loader, groups, cp, javaOpts, javaHome) => - val results = groups map { + val tasks = groups map { case Tests.Group(name, tests, config) => config.subproc match { case Tests.Fork(extraJvm) => @@ -297,7 +297,7 @@ object Defaults extends BuildCommon Tests(frameworkMap, loader, tests, config, s.log) } } - Tests.foldTasks(results) + Tests.foldTasks(tasks) }, test <<= (executeTests, streams, resolvedScoped, state) map { (results, s, scoped, st) => @@ -374,7 +374,7 @@ object Defaults extends BuildCommon (streams, loadedTestFrameworks, testFilter in key, testGrouping in key, testLoader, resolvedScoped, result, fullClasspath in key, javaOptions in key, javaHome in key, state) flatMap { case (s, frameworks, filter, groups, loader, scoped, (selected, frameworkOptions), cp, javaOpts, javaHome, st) => implicit val display = Project.showContextKey(st) - val results = groups map { + val tasks = groups map { case Tests.Group(name, tests, config) => val modifiedOpts = Tests.Filter(filter(selected)) +: Tests.Argument(frameworkOptions : _*) +: config.options val newConfig = config.copy(options = modifiedOpts) @@ -385,7 +385,7 @@ object Defaults extends BuildCommon Tests(frameworks, loader, tests, newConfig, s.log) } } - Tests.foldTasks(results) map (Tests.showResults(s.log, _, noTestsMessage(scoped))) + Tests.foldTasks(tasks) map (Tests.showResults(s.log, _, noTestsMessage(scoped))) } } diff --git a/main/Keys.scala b/main/Keys.scala index 8c41696dd..f332a7a6c 100644 --- a/main/Keys.scala +++ b/main/Keys.scala @@ -198,7 +198,7 @@ object Keys val testListeners = TaskKey[Seq[TestReportListener]]("test-listeners", "Defines test listeners.") val testExecution = TaskKey[Tests.Execution]("test-execution", "Settings controlling test execution") val testFilter = TaskKey[Seq[String] => String => Boolean]("test-filter", "Filter controlling whether the test is executed") - val testGrouping = TaskKey[Seq[Tests.Group]]("test-grouping", "Groups discovered tests into groups. Groups are run sequentially.") + val testGrouping = TaskKey[Seq[Tests.Group]]("test-grouping", "Groups discovered tests into groups.") val isModule = AttributeKey[Boolean]("is-module", "True if the target is a module.") // Classpath/Dependency Management Keys diff --git a/main/Tags.scala b/main/Tags.scala index 346f09275..25df28a3c 100644 --- a/main/Tags.scala +++ b/main/Tags.scala @@ -18,6 +18,7 @@ object Tags val CPU = Tag("cpu") val Network = Tag("network") val Disk = Tag("disk") + val Subprocess = Tag("subprocess") /** Describes a restriction on concurrently executing tasks. * A Rule is constructed using one of the Tags.limit* methods. */ @@ -55,4 +56,4 @@ object Tags def limitUntagged(max: Int): Rule = limit(Untagged, max) def limit(tag: Tag, max: Int): Rule = new Single(tag, max) def limitSum(max: Int, tags: Tag*): Rule = new Sum(tags, max) -} \ No newline at end of file +} diff --git a/main/actions/ForkTests.scala b/main/actions/ForkTests.scala index 44bdb796d..2fbb6624d 100755 --- a/main/actions/ForkTests.scala +++ b/main/actions/ForkTests.scala @@ -90,8 +90,8 @@ private[sbt] object ForkTests { } } - testListeners.foreach(_.doInit()) try { + testListeners.foreach(_.doInit()) new Thread(Acceptor).start() val fullCp = classpath ++: Seq(IO.classLocationFile[ForkMain], IO.classLocationFile[Framework]) @@ -104,6 +104,6 @@ private[sbt] object ForkTests { val result = Acceptor.output testListeners.foreach(_.doComplete(result._1)) result - } + } tagw (config.tags: _*) } } diff --git a/main/actions/Tests.scala b/main/actions/Tests.scala index 5406d7d68..f4ace8cdf 100644 --- a/main/actions/Tests.scala +++ b/main/actions/Tests.scala @@ -127,11 +127,9 @@ object Tests def processResults(results: Iterable[(String, TestResult.Value)]): (TestResult.Value, Map[String, TestResult.Value]) = (overall(results.map(_._2)), results.toMap) def foldTasks(results: Seq[Task[Output]]): Task[Output] = - (task((TestResult.Passed, Map.empty[String, TestResult.Value])) /: results) { - reducePair(_, _, { - case ((v1, m1), (v2, m2)) => (if (v1.id < v2.id) v2 else v1, m1 ++ m2) - }) - } + reduced(results.toIndexedSeq, { + case ((v1, m1), (v2, m2)) => (if (v1.id < v2.id) v2 else v1, m1 ++ m2) + }) def overall(results: Iterable[TestResult.Value]): TestResult.Value = (TestResult.Passed /: results) { (acc, result) => if(acc.id < result.id) result else acc } def discover(frameworks: Seq[Framework], analysis: Analysis, log: Logger): (Seq[TestDefinition], Set[String]) =