Deflake MemoizingEvaluatorTest#shutDownBuildOnCachedError_Done: the test is trying to prevent B-fail-fast-parent from starting to build until either (a) the build is interrupted or (b) A-slow-set-value-parent tries to set its value (which would be unexpected). However, we don't do an isDirty() check in AbstractParallelEvaluator$Evaluate#run anymore, so the synchronization was just wrong.
@@ -4571,28 +4571,26 @@ public class MemoizingEvaluatorTest {
public void shutDownBuildOnCachedError_Done() throws Exception {
// errorKey will be invalidated due to its dependence on invalidatedKey, but later revalidated
// since invalidatedKey re-evaluates to the same value on a subsequent build.
- final SkyKey errorKey = GraphTester.toSkyKey("error");
+ SkyKey errorKey = GraphTester.toSkyKey("error");
SkyKey invalidatedKey = GraphTester.nonHermeticKey("invalidated-leaf");
tester.set(invalidatedKey, new StringValue("invalidated-leaf-value"));
tester.getOrCreate(errorKey).addDependency(invalidatedKey).setHasError(true);
// Names are alphabetized in reverse deps of errorKey.
- final SkyKey fastToRequestSlowToSetValueKey = GraphTester.toSkyKey("A-slow-set-value-parent");
- final SkyKey failingKey = GraphTester.toSkyKey("B-fast-fail-parent");
+ SkyKey fastToRequestSlowToSetValueKey = GraphTester.toSkyKey("A-slow-set-value-parent");
+ SkyKey failingKey = GraphTester.toSkyKey("B-fast-fail-parent");
tester.getOrCreate(fastToRequestSlowToSetValueKey).addDependency(errorKey)
.setComputedValue(CONCATENATE);
tester.getOrCreate(failingKey).addDependency(errorKey).setComputedValue(CONCATENATE);
// We only want to force a particular order of operations at some points during evaluation.
- final AtomicBoolean synchronizeThreads = new AtomicBoolean(false);
+ AtomicBoolean synchronizeThreads = new AtomicBoolean(false);
// We don't expect slow-set-value to actually be built, but if it is, we wait for it.
- final CountDownLatch slowBuilt = new CountDownLatch(1);
+ CountDownLatch slowBuilt = new CountDownLatch(1);
injectGraphListenerForTesting(
- new Listener() {
- @Override
- public void accept(SkyKey key, EventType type, Order order, Object context) {
+ (key, type, order, context) -> {
if (!synchronizeThreads.get()) {
return;
}
- if (type == EventType.IS_DIRTY && key.equals(failingKey)) {
+ if (type == EventType.GET_DIRTY_STATE && key.equals(failingKey)) {
// Wait for the build to abort or for the other node to incorrectly build.
try {
assertThat(slowBuilt.await(TestUtils.WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS))
@@ -4616,7 +4614,6 @@ public class MemoizingEvaluatorTest {
Thread.currentThread().interrupt();
}
}
- }
},
/*deterministic=*/ true);
// Initialize graph.
