diff options
author | Janak Ramakrishnan <janakr@google.com> | 2016-12-29 21:49:56 +0000 |
---|---|---|
committer | John Cater <jcater@google.com> | 2017-01-03 15:03:05 +0000 |
commit | 112840b4d6fafd04e2381a2e52fbad848a818ea6 (patch) | |
tree | f82825c5b02480612178f8238812590925c67909 /src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionTest.java | |
parent | c31f351a191d6927a6483384826297e5549cf426 (diff) |
Remove WalkableGraph#exists and allow WalkableGraph#getValue and WalkableGraph#getException to be given non-existent keys without crashing. Add WalkableGraph#isCycle to fill the gap in testing for the difference between non-existence and depending on a cycle.
--
PiperOrigin-RevId: 143205289
MOS_MIGRATED_REVID=143205289
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionTest.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionTest.java index b29ec04b0d..cda7fbc775 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionTest.java @@ -15,6 +15,7 @@ package com.google.devtools.build.lib.skyframe; import static com.google.common.truth.Truth.assertThat; import static com.google.devtools.build.skyframe.EvaluationResultSubjectFactory.assertThatEvaluationResult; +import static com.google.devtools.build.skyframe.WalkableGraphUtils.exists; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; @@ -61,7 +62,7 @@ public class PrepareDepsOfPatternsFunctionTest extends BuildViewTestCase { assertValidValue(walkableGraph, getKeyForLabel(Label.create("@//foo", "foo"))); // And the graph does not contain a value for the target "@//foo:foo2". - assertFalse(walkableGraph.exists(getKeyForLabel(Label.create("@//foo", "foo2")))); + assertFalse(exists(getKeyForLabel(Label.create("@//foo", "foo2")), walkableGraph)); } @Test @@ -106,7 +107,7 @@ public class PrepareDepsOfPatternsFunctionTest extends BuildViewTestCase { WalkableGraph walkableGraph = getGraphFromPatternsEvaluation(patternSequence); // Then the graph does not contain an entry for ":foo", - assertFalse(walkableGraph.exists(getKeyForLabel(Label.create("@//foo", "foo")))); + assertFalse(exists(getKeyForLabel(Label.create("@//foo", "foo")), walkableGraph)); } @Test @@ -188,7 +189,7 @@ public class PrepareDepsOfPatternsFunctionTest extends BuildViewTestCase { assertContainsEvent("Skipping '" + bogusPattern + "': "); // And then the graph contains a value for the legit target pattern's target "@//foo:foo". - assertTrue(walkableGraph.exists(getKeyForLabel(Label.create("@//foo", "foo")))); + assertTrue(exists(getKeyForLabel(Label.create("@//foo", "foo")), walkableGraph)); } // Helpers: @@ -260,7 +261,6 @@ public class PrepareDepsOfPatternsFunctionTest extends BuildViewTestCase { private static void assertValidValue( WalkableGraph graph, SkyKey key, boolean expectTransitiveException) throws InterruptedException { - assertTrue(graph.exists(key)); assertNotNull(graph.getValue(key)); if (expectTransitiveException) { assertNotNull(graph.getException(key)); @@ -271,7 +271,6 @@ public class PrepareDepsOfPatternsFunctionTest extends BuildViewTestCase { private static Exception assertException(WalkableGraph graph, SkyKey key) throws InterruptedException { - assertTrue(graph.exists(key)); assertNull(graph.getValue(key)); Exception exception = graph.getException(key); assertNotNull(exception); |