diff options
author | Janak Ramakrishnan <janakr@google.com> | 2016-05-10 20:01:40 +0000 |
---|---|---|
committer | Klaus Aehlig <aehlig@google.com> | 2016-05-11 10:23:20 +0000 |
commit | 8be7fd0bb7cc8f0819f23ef4bbf6328472110db7 (patch) | |
tree | 0d62d37680a4e38c0f5dbd5c921db4822016711e /src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java | |
parent | 23da7ba41a20bdafdf3776ab61c05fbddc269f94 (diff) |
Allow Skyframe tests to use the NotifyingGraph and DeterministicGraph helpers to enforce concurrency synchronization points and determinism even if they are not using an InMemoryGraph-backed evaluator.
--
MOS_MIGRATED_REVID=121977783
Diffstat (limited to 'src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java b/src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java index 49706c88c9..19769888fb 100644 --- a/src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java +++ b/src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java @@ -63,7 +63,7 @@ import javax.annotation.Nullable; */ @RunWith(Enclosed.class) public class EagerInvalidatorTest { - protected InMemoryGraph graph; + protected InMemoryGraphImpl graph; protected GraphTester tester = new GraphTester(); protected InvalidationState state = newInvalidationState(); protected AtomicReference<InvalidatingNodeVisitor<?>> visitor = new AtomicReference<>(); @@ -211,7 +211,7 @@ public class EagerInvalidatorTest { throw new UnsupportedOperationException(); } }; - graph = new InMemoryGraph(); + graph = new InMemoryGraphImpl(); set("a", "a"); set("b", "b"); tester.getOrCreate("ab").addDependency("a").addDependency("b") @@ -256,7 +256,7 @@ public class EagerInvalidatorTest { // Given a graph consisting of two nodes, "a" and "ab" such that "ab" depends on "a", // And given "ab" is in error, - graph = new InMemoryGraph(); + graph = new InMemoryGraphImpl(); set("a", "a"); tester.getOrCreate("ab").addDependency("a").setHasError(true); eval(false, skyKey("ab")); @@ -297,7 +297,7 @@ public class EagerInvalidatorTest { throw new UnsupportedOperationException(); } }; - graph = new InMemoryGraph(); + graph = new InMemoryGraphImpl(); invalidateWithoutError(receiver, skyKey("a")); assertThat(invalidated).isEmpty(); set("a", "a"); @@ -313,7 +313,7 @@ public class EagerInvalidatorTest { WeakReference<HeavyValue> weakRef = new WeakReference<>(heavyValue); tester.set("a", heavyValue); - graph = new InMemoryGraph(); + graph = new InMemoryGraphImpl(); eval(false, key); invalidate(graph, null, key); @@ -331,7 +331,7 @@ public class EagerInvalidatorTest { @Test public void reverseDepsConsistent() throws Exception { - graph = new InMemoryGraph(); + graph = new InMemoryGraphImpl(); set("a", "a"); set("b", "b"); set("c", "c"); @@ -371,7 +371,7 @@ public class EagerInvalidatorTest { @Test public void interruptChild() throws Exception { - graph = new InMemoryGraph(); + graph = new InMemoryGraphImpl(); int numValues = 50; // More values than the invalidator has threads. final SkyKey[] family = new SkyKey[numValues]; final SkyKey child = GraphTester.skyKey("child"); @@ -435,8 +435,7 @@ public class EagerInvalidatorTest { assertFalse(state.isEmpty()); final Set<SkyKey> invalidated = Sets.newConcurrentHashSet(); assertFalse(isInvalidated(parent)); - SkyValue parentValue = graph.getValue(parent); - assertNotNull(parentValue); + assertNotNull(graph.get(parent).getValue()); receiver = new EvaluationProgressReceiver() { @Override public void invalidated(SkyKey skyKey, InvalidationState state) { @@ -510,7 +509,7 @@ public class EagerInvalidatorTest { Random random = new Random(TestUtils.getRandomSeed()); int graphSize = 1000; int tries = 5; - graph = new InMemoryGraph(); + graph = new InMemoryGraphImpl(); SkyKey[] values = constructLargeGraph(graphSize); eval(/*keepGoing=*/false, values); final Thread mainThread = Thread.currentThread(); @@ -579,7 +578,7 @@ public class EagerInvalidatorTest { } protected void setupInvalidatableGraph() throws Exception { - graph = new InMemoryGraph(); + graph = new InMemoryGraphImpl(); set("a", "a"); set("b", "b"); tester.getOrCreate("ab").addDependency("a").addDependency("b").setComputedValue(CONCATENATE); |