mirror of https://github.com/sbt/sbt.git
Improve forked test debugging by listing tests run by sbt. Fixes #868.
This helps diagnosing issues on the sbt/framework border by verifying that sbt is properly collecting and invoking tests.
This commit is contained in:
parent
77ed899a96
commit
277813dd0a
|
|
@ -509,7 +509,7 @@ object Defaults extends BuildCommon
|
|||
filters.map { f => (s: String) => f accept s }
|
||||
}
|
||||
def detectTests: Initialize[Task[Seq[TestDefinition]]] = (loadedTestFrameworks, compile, streams) map { (frameworkMap, analysis, s) =>
|
||||
Tests.discover(frameworkMap.values.toSeq, analysis, s.log)._1
|
||||
Tests.discover(frameworkMap.values.toList, analysis, s.log)._1
|
||||
}
|
||||
def defaultRestrictions: Initialize[Seq[Tags.Rule]] = parallelExecution { par =>
|
||||
val max = EvaluateTask.SystemProcessors
|
||||
|
|
|
|||
|
|
@ -177,12 +177,13 @@ public class ForkMain {
|
|||
for (Fingerprint testFingerprint : framework.fingerprints()) {
|
||||
for (TaskDef test : tests) {
|
||||
// TODO: To pass in correct explicitlySpecified and selectors
|
||||
if (matches(testFingerprint, test.fingerprint()))
|
||||
if (matches(testFingerprint, test.fingerprint()))
|
||||
filteredTests.add(new TaskDef(test.fullyQualifiedName(), test.fingerprint(), test.explicitlySpecified(), test.selectors()));
|
||||
}
|
||||
}
|
||||
final Runner runner = framework.runner(frameworkArgs, remoteFrameworkArgs, getClass().getClassLoader());
|
||||
Task[] tasks = runner.tasks(filteredTests.toArray(new TaskDef[filteredTests.size()]));
|
||||
logDebug(os, "Runner for " + framework.getClass().getName() + " produced " + tasks.length + " initial tasks for " + filteredTests.size() + " tests.");
|
||||
for (Task task : tasks)
|
||||
runTestSafe(task, runner, loggers, os);
|
||||
runner.done();
|
||||
|
|
@ -236,7 +237,10 @@ public class ForkMain {
|
|||
try {
|
||||
final List<ForkEvent> eventList = new ArrayList<ForkEvent>();
|
||||
EventHandler handler = new EventHandler() { public void handle(Event e){ eventList.add(new ForkEvent(e)); } };
|
||||
logDebug(os, " Running " + taskDef);
|
||||
nestedTasks = task.execute(handler, loggers);
|
||||
if(nestedTasks.length > 0 || eventList.size() > 0)
|
||||
logDebug(os, " Produced " + nestedTasks.length + " nested tasks and " + eventList.size() + " events.");
|
||||
events = eventList.toArray(new ForkEvent[eventList.size()]);
|
||||
}
|
||||
catch (Throwable t) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue