Fixed STC logic when skipping steps and groups of steps. Doh!
Change-Id: I6a1f690133bc0a5d1efbdf1333fe80a983e7dda8
diff --git a/tools/test/scenarios/fast.xml b/tools/test/scenarios/fast.xml
index 3cfe2c6..0d38c45 100644
--- a/tools/test/scenarios/fast.xml
+++ b/tools/test/scenarios/fast.xml
@@ -26,5 +26,5 @@
<dependency name="Archetypes" requires="Setup"/>
<import file="${ONOS_SCENARIOS}/wrapup.xml"/>
- <dependency name="Wrapup" requires="~Archetypes,~Setup,~Net-Fast"/>
+ <dependency name="Wrapup" requires="Prerequisites,~Archetypes,~Setup,~Net-Fast"/>
</scenario>
diff --git a/utils/stc/src/main/java/org/onlab/stc/Coordinator.java b/utils/stc/src/main/java/org/onlab/stc/Coordinator.java
index ef1c31f..228e783 100644
--- a/utils/stc/src/main/java/org/onlab/stc/Coordinator.java
+++ b/utils/stc/src/main/java/org/onlab/stc/Coordinator.java
@@ -25,6 +25,7 @@
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
+import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -41,7 +42,7 @@
*/
public class Coordinator {
- private static final int MAX_THREADS = 16;
+ private static final int MAX_THREADS = 64;
private final ExecutorService executor = newFixedThreadPool(MAX_THREADS);
@@ -143,13 +144,15 @@
}
/**
- * Wants for completion of the entire process flow.
+ * Waits for completion of the entire process flow.
*
* @return exit code to use
* @throws InterruptedException if interrupted while waiting for completion
*/
public int waitFor() throws InterruptedException {
- latch.await();
+ while (!store.isComplete()) {
+ latch.await(1, TimeUnit.SECONDS);
+ }
return store.hasFailures() ? 1 : 0;
}
@@ -234,15 +237,26 @@
substitute(step.command())));
}
} else if (directive == SKIP) {
- if (step instanceof Group) {
- Group group = (Group) step;
- group.children().forEach(child -> delegate.onCompletion(child, SKIPPED));
- }
- delegate.onCompletion(step, SKIPPED);
+ skipStep(step);
}
}
/**
+ * Recursively skips the specified step or group and any steps/groups within.
+ *
+ * @param step step or group
+ */
+ private void skipStep(Step step) {
+ if (step instanceof Group) {
+ Group group = (Group) step;
+ store.markComplete(step, SKIPPED);
+ group.children().forEach(this::skipStep);
+ }
+ delegate.onCompletion(step, SKIPPED);
+
+ }
+
+ /**
* Determines the state of the specified step.
*
* @param step test step
@@ -258,8 +272,8 @@
Status depStatus = store.getStatus(dependency.dst());
if (depStatus == WAITING || depStatus == IN_PROGRESS) {
return NOOP;
- } else if ((depStatus == FAILED || depStatus == SKIPPED) &&
- !dependency.isSoft()) {
+ } else if (((depStatus == FAILED || depStatus == SKIPPED) && !dependency.isSoft()) ||
+ (step.group() != null && store.getStatus(step.group()) == SKIPPED)) {
return SKIP;
}
}