Permalink
Browse files

Added explicitlySpecified and selectors field to ForkTestDefinition, …

…and change ForkMain to use explicitlySpecified and selectors value sent from ForkTests.
  • Loading branch information...
cheeseng committed Jun 27, 2013
1 parent 0c66d1a commit 86f47bd67d4dcb13a60f0ec55f12181928d077b3
Showing with 17 additions and 9 deletions.
  1. +1 −1 main/actions/src/main/scala/sbt/ForkTests.scala
  2. +16 −8 testing/agent/src/main/java/sbt/ForkMain.java
@@ -61,7 +61,7 @@ private[sbt] object ForkTests {
os.writeBoolean(log.ansiCodesSupported)
val testsFiltered = tests.filter(test => filters.forall(_(test.name))).map{
- t => new ForkTestDefinition(t.name, t.fingerprint)
+ t => new ForkTestDefinition(t.name, t.fingerprint, t.explicitlySpecified, t.selectors)
}.toArray
os.writeObject(testsFiltered)
@@ -42,14 +42,21 @@
public static class ForkTestDefinition implements Serializable {
public String name;
public Fingerprint fingerprint;
+ public boolean explicitlySpecified;
+ public Selector[] selectors;
- public ForkTestDefinition(String name, Fingerprint fingerprint) {
+ public ForkTestDefinition(String name, Fingerprint fingerprint, boolean explicitlySpecified, Selector[] selectors) {
this.name = name;
if (fingerprint instanceof SubclassFingerprint) {
this.fingerprint = new SubclassFingerscan((SubclassFingerprint) fingerprint);
} else {
this.fingerprint = new AnnotatedFingerscan((AnnotatedFingerprint) fingerprint);
}
+ this.explicitlySpecified = explicitlySpecified;
+ int length = selectors.length;
+ this.selectors = new Selector[length];
+ for (int i = 0; i < length; i++)
+ this.selectors[i] = forkSelector(selectors[i]);
}
}
static class ForkError extends Exception {
@@ -64,6 +71,13 @@ public ForkTestDefinition(String name, Fingerprint fingerprint) {
public Exception getCause() { return cause; }
}
+ static Selector forkSelector(Selector selector) {
+ if (selector instanceof Serializable)
+ return selector;
+ else
+ throw new UnsupportedOperationException("Selector implementation must be Serializable, but " + selector.getClass().getName() + " is not.");
+ }
+
static class ForkEvent implements Event, Serializable {
private String fullyQualifiedName;
private Fingerprint fingerprint;
@@ -93,12 +107,6 @@ public ForkTestDefinition(String name, Fingerprint fingerprint) {
public Status status() { return status; }
public OptionalThrowable throwable() { return throwable; }
public long duration() { return duration; }
- protected Selector forkSelector(Selector selector) {
- if (selector instanceof Serializable)
- return selector;
- else
- throw new UnsupportedOperationException("Selector implementation must be Serializable.");
- }
}
public static void main(String[] args) throws Exception {
Socket socket = new Socket(InetAddress.getByName(null), Integer.valueOf(args[0]));
@@ -190,7 +198,7 @@ void runTests(ObjectInputStream is, final ObjectOutputStream os) throws Exceptio
for (ForkTestDefinition test : tests) {
// TODO: To pass in correct explicitlySpecified and selectors
if (matches(testFingerprint, test.fingerprint))
- filteredTests.add(new TaskDef(test.name, test.fingerprint, false, new Selector[] { new SuiteSelector() }));
+ filteredTests.add(new TaskDef(test.name, test.fingerprint, test.explicitlySpecified, test.selectors));
}
}
final Runner runner = framework.runner(frameworkArgs, remoteFrameworkArgs, getClass().getClassLoader());

0 comments on commit 86f47bd

Please sign in to comment.