Some more fixes.

This commit is contained in:
Eugene Vigdorchik 2012-04-03 11:49:41 +04:00
parent 4abefbd3b6
commit c4385adce0
4 changed files with 17 additions and 8 deletions

View File

@ -57,6 +57,7 @@ object Defaults extends BuildCommon
onComplete <<= taskTemporaryDirectory { dir => () => IO.delete(dir); IO.createDirectory(dir) }, onComplete <<= taskTemporaryDirectory { dir => () => IO.delete(dir); IO.createDirectory(dir) },
concurrentRestrictions <<= concurrentRestrictions or defaultRestrictions, concurrentRestrictions <<= concurrentRestrictions or defaultRestrictions,
parallelExecution :== true, parallelExecution :== true,
parallelTestGroups := 1,
sbtVersion <<= appConfiguration { _.provider.id.version }, sbtVersion <<= appConfiguration { _.provider.id.version },
sbtBinaryVersion <<= sbtVersion apply binarySbtVersion, sbtBinaryVersion <<= sbtVersion apply binarySbtVersion,
sbtResolver <<= sbtVersion { sbtV => if(sbtV endsWith "-SNAPSHOT") Classpaths.typesafeSnapshots else Classpaths.typesafeReleases }, sbtResolver <<= sbtVersion { sbtV => if(sbtV endsWith "-SNAPSHOT") Classpaths.typesafeSnapshots else Classpaths.typesafeReleases },
@ -117,10 +118,10 @@ object Defaults extends BuildCommon
excludeFilter :== (".*" - ".") || HiddenFileFilter, excludeFilter :== (".*" - ".") || HiddenFileFilter,
pomIncludeRepository :== Classpaths.defaultRepositoryFilter pomIncludeRepository :== Classpaths.defaultRepositoryFilter
)) ))
def defaultTestTasks(key: Scoped): Seq[Setting[_]] = Seq( def defaultTestTasks(key: Scoped): Seq[Setting[_]] = inTask(key)(Seq(
tags in key := Seq(Tags.Test -> 1, Tags.Subprocess -> 1), tags := Seq(Tags.Test -> 1),
logBuffered in key := true logBuffered := true
) ))
def projectCore: Seq[Setting[_]] = Seq( def projectCore: Seq[Setting[_]] = Seq(
name <<= thisProject(_.id), name <<= thisProject(_.id),
logManager <<= extraLoggers(LogManager.defaults), logManager <<= extraLoggers(LogManager.defaults),
@ -337,8 +338,9 @@ object Defaults extends BuildCommon
} }
def testExecutionTask(task: Scoped): Initialize[Task[Tests.Execution]] = def testExecutionTask(task: Scoped): Initialize[Task[Tests.Execution]] =
(testOptions in task, parallelExecution in task, fork in task, javaOptions in task, tags in task) map { (testOptions in task, parallelExecution in task, fork in task, javaOptions in task, tags in task, parallelTestGroups in task) map {
(opts, par, fork, jvmOpts, ts) => new Tests.Execution(opts, par, if (fork) Tests.Fork(jvmOpts) else Tests.InProcess, ts) (opts, par, fork, jvmOpts, ts, lim) =>
new Tests.Execution(opts, par, if (fork) Tests.Fork(jvmOpts) else Tests.InProcess, if (fork) ts :+ (Tags.ForkedTestGroup -> lim) else ts)
} }
def testQuickFilter: Initialize[Task[Seq[String] => String => Boolean]] = def testQuickFilter: Initialize[Task[Seq[String] => String => Boolean]] =

View File

@ -199,6 +199,7 @@ object Keys
val testExecution = TaskKey[Tests.Execution]("test-execution", "Settings controlling test execution") 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 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.") val testGrouping = TaskKey[Seq[Tests.Group]]("test-grouping", "Groups discovered tests into groups.")
val parallelTestGroups = SettingKey[Int]("parallel-test-groups", "Maximum number of test groups that may run at the same time.")
val isModule = AttributeKey[Boolean]("is-module", "True if the target is a module.") val isModule = AttributeKey[Boolean]("is-module", "True if the target is a module.")
// Classpath/Dependency Management Keys // Classpath/Dependency Management Keys

View File

@ -18,7 +18,8 @@ object Tags
val CPU = Tag("cpu") val CPU = Tag("cpu")
val Network = Tag("network") val Network = Tag("network")
val Disk = Tag("disk") val Disk = Tag("disk")
val Subprocess = Tag("subprocess")
val ForkedTestGroup = Tag("forked-test-group")
/** Describes a restriction on concurrently executing tasks. /** Describes a restriction on concurrently executing tasks.
* A Rule is constructed using one of the Tags.limit* methods. */ * A Rule is constructed using one of the Tags.limit* methods. */

View File

@ -70,7 +70,12 @@ public class ForkMain {
Socket socket = new Socket(InetAddress.getByName(null), Integer.valueOf(args[0])); Socket socket = new Socket(InetAddress.getByName(null), Integer.valueOf(args[0]));
final ObjectInputStream is = new ObjectInputStream(socket.getInputStream()); final ObjectInputStream is = new ObjectInputStream(socket.getInputStream());
final ObjectOutputStream os = new ObjectOutputStream(socket.getOutputStream()); final ObjectOutputStream os = new ObjectOutputStream(socket.getOutputStream());
new Run().run(is, os); try {
new Run().run(is, os);
} finally {
is.close();
os.close();
}
} }
private static class Run { private static class Run {
boolean matches(Fingerprint f1, Fingerprint f2) { boolean matches(Fingerprint f1, Fingerprint f2) {