aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/utils/stc
diff options
context:
space:
mode:
authorAshlee Young <ashlee@wildernessvoice.com>2015-11-05 14:00:42 -0800
committerAshlee Young <ashlee@wildernessvoice.com>2015-11-05 14:00:42 -0800
commitb34f82bf11934fc6b938ef997d536a7ccea76c36 (patch)
tree10559ebf65962abb741883ca9d23aec241ced504 /framework/src/onos/utils/stc
parent2cdecb8c41956d7dd8ab5d59591ebc21f3c64a9e (diff)
Updates ONOS tree to checkin id ca9cc8e28eba18da77f4fa021fb7c3a3f76e5d44
upstream. Change-Id: I49f8e41733afea8101ec50c0102213c8d18949ae Signed-off-by: Ashlee Young <ashlee@wildernessvoice.com>
Diffstat (limited to 'framework/src/onos/utils/stc')
-rw-r--r--framework/src/onos/utils/stc/src/main/java/org/onlab/stc/Coordinator.java34
-rw-r--r--framework/src/onos/utils/stc/src/main/java/org/onlab/stc/Step.java2
2 files changed, 25 insertions, 11 deletions
diff --git a/framework/src/onos/utils/stc/src/main/java/org/onlab/stc/Coordinator.java b/framework/src/onos/utils/stc/src/main/java/org/onlab/stc/Coordinator.java
index ef1c31f3..228e7834 100644
--- a/framework/src/onos/utils/stc/src/main/java/org/onlab/stc/Coordinator.java
+++ b/framework/src/onos/utils/stc/src/main/java/org/onlab/stc/Coordinator.java
@@ -25,6 +25,7 @@ import java.util.Map;
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 @@ import static org.onlab.stc.Coordinator.Status.*;
*/
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 @@ public class Coordinator {
}
/**
- * 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 @@ public class Coordinator {
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 @@ public class Coordinator {
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;
}
}
diff --git a/framework/src/onos/utils/stc/src/main/java/org/onlab/stc/Step.java b/framework/src/onos/utils/stc/src/main/java/org/onlab/stc/Step.java
index 3d8ea983..e14addb5 100644
--- a/framework/src/onos/utils/stc/src/main/java/org/onlab/stc/Step.java
+++ b/framework/src/onos/utils/stc/src/main/java/org/onlab/stc/Step.java
@@ -101,7 +101,7 @@ public class Step implements Vertex {
@Override
public int hashCode() {
- return Objects.hash(name);
+ return name.hashCode();
}
@Override