Skip to content
Permalink
Browse files
Fix a couple forkscanner testcase quirks, and put JENKINS-39839 to be…
…d along with JENKINS-39841
  • Loading branch information
svanoort committed Feb 21, 2017
1 parent 5c11823 commit 96e2c2ed99384a9c9f4fb80cc8f8876d9b225504
@@ -563,24 +563,24 @@ protected FlowNode next(@Nonnull FlowNode current, @Nonnull Collection<FlowNode>
// welp, we're done with this node, guess we consult the queue?
} else if (parents.size() == 1) {
FlowNode p = parents.get(0);
if (p == currentParallelStartNode) {
if (p == currentParallelStartNode || isParallelStart(p)) {
// Terminating a parallel scan
FlowNode temp = hitParallelStart();
if (temp != null) { // Start node for current parallel block now that it is done
nextType = NodeType.PARALLEL_START;
return temp;
}
} else if (!blackList.contains(p)) {
if (p instanceof BlockStartNode && p.getPersistentAction(ThreadNameAction.class) != null) {
nextType = NodeType.PARALLEL_BRANCH_START;
} else if (ForkScanner.isParallelEnd(p)) {
nextType = NodeType.PARALLEL_END;
} else {
nextType = NodeType.NORMAL;
} else {
if (isParallelEnd(current)) {
BlockEndNode end = ((BlockEndNode) current);
FlowNode possibleOutput = hitParallelEnd(end, parents, blackList); // possibleOutput can only be p
}
if (!blackList.contains(p)) {
nextType = getNodeType(p);
return p;
}
return p;
}
} else if (current instanceof BlockEndNode && parents.size() > 1) {
} else if (isParallelEnd(current)) {
// We must be a BlockEndNode that begins this
BlockEndNode end = ((BlockEndNode) current);
FlowNode possibleOutput = hitParallelEnd(end, parents, blackList); // What if output is block but other branches aren't?
@@ -709,7 +709,11 @@ public void visitSimpleChunks(@Nonnull SimpleChunkVisitor visitor, @Nonnull Chun
case NORMAL:
break;
case PARALLEL_END:
visitor.parallelEnd(this.currentParallelStartNode, myCurrent, this);
if (this.currentParallelStartNode != null) {
visitor.parallelEnd(this.currentParallelStartNode, myCurrent, this);
} else if (myCurrent instanceof BlockEndNode){
visitor.parallelEnd(((BlockEndNode) myCurrent).getStartNode(), myCurrent, this);
}
break;
case PARALLEL_START:
visitor.parallelStart(myCurrent, prev, this);
@@ -457,10 +457,10 @@ public void testSingleNestedParallelBranches() throws Exception {
ForkScanner scanner = new ForkScanner();
scanner.setup(b.getExecution().getCurrentHeads());
scanner.visitSimpleChunks(visitor, new ChunkFinderWithoutChunks());
Assert.assertEquals(2, visitor.filteredCallsByType(TestVisitor.CallType.PARALLEL_START));
Assert.assertEquals(2, visitor.filteredCallsByType(TestVisitor.CallType.PARALLEL_END));
Assert.assertEquals(2, visitor.filteredCallsByType(TestVisitor.CallType.PARALLEL_BRANCH_START));
Assert.assertEquals(2, visitor.filteredCallsByType(TestVisitor.CallType.PARALLEL_BRANCH_END));
Assert.assertEquals(2, visitor.filteredCallsByType(TestVisitor.CallType.PARALLEL_START).size());
Assert.assertEquals(2, visitor.filteredCallsByType(TestVisitor.CallType.PARALLEL_END).size());
Assert.assertEquals(2, visitor.filteredCallsByType(TestVisitor.CallType.PARALLEL_BRANCH_START).size());
Assert.assertEquals(2, visitor.filteredCallsByType(TestVisitor.CallType.PARALLEL_BRANCH_END).size());
}

/** Reference the flow graphs in {@link #SIMPLE_PARALLEL_RUN} and {@link #NESTED_PARALLEL_RUN} */

0 comments on commit 96e2c2e

Please sign in to comment.