Deflake ParallelEvaluatorTest.errorBubblesToParentsOfTopLevelValue: error cannot finish building until top registers a dep on it, and we can only know that by listening to the addReverseDep call.
PiperOrigin-RevId: 186499232
diff --git a/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java b/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java
index 558c5ed..d0d7b97 100644
--- a/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java
+++ b/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java
@@ -773,14 +773,23 @@
@Test
public void errorBubblesToParentsOfTopLevelValue() throws Exception {
- graph = new InMemoryGraphImpl();
SkyKey parentKey = GraphTester.toSkyKey("parent");
- final SkyKey errorKey = GraphTester.toSkyKey("error");
- final CountDownLatch latch = new CountDownLatch(1);
+ SkyKey errorKey = GraphTester.toSkyKey("error");
+ CountDownLatch latch = new CountDownLatch(1);
+ graph =
+ new NotifyingHelper.NotifyingProcessableGraph(
+ new InMemoryGraphImpl(),
+ (key, type, order, context) -> {
+ if (key.equals(errorKey)
+ && parentKey.equals(context)
+ && type == EventType.ADD_REVERSE_DEP
+ && order == Order.AFTER) {
+ latch.countDown();
+ }
+ });
tester.getOrCreate(errorKey).setBuilder(new ChainedFunction(null, /*waitToFinish=*/latch, null,
false, /*value=*/null, ImmutableList.<SkyKey>of()));
- tester.getOrCreate(parentKey).setBuilder(new ChainedFunction(/*notifyStart=*/latch, null, null,
- false, new StringValue("unused"), ImmutableList.of(errorKey)));
+ tester.getOrCreate(parentKey).addDependency(errorKey).setComputedValue(CONCATENATE);
EvaluationResult<StringValue> result = eval( /*keepGoing=*/false,
ImmutableList.of(parentKey, errorKey));
assertWithMessage(result.toString()).that(result.errorMap().size()).isEqualTo(2);