aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/skyframe
diff options
context:
space:
mode:
authorGravatar Han-Wen Nienhuys <hanwen@google.com>2015-02-17 11:15:16 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-02-17 11:15:16 +0000
commit8d356be3383021b8f91c584dd35e0813cf5ac2fe (patch)
treef5af91c17f332bfb807871cc7220be355bba66d5 /src/test/java/com/google/devtools/build/skyframe
parent52fb6a26bd45bc2db2651bac8505833a1a992f78 (diff)
Don't assert in method that is called on other thread.
-- MOS_MIGRATED_REVID=86478884
Diffstat (limited to 'src/test/java/com/google/devtools/build/skyframe')
-rw-r--r--src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java15
1 files changed, 13 insertions, 2 deletions
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 5394437c62..64b5948cb7 100644
--- a/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java
+++ b/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java
@@ -1985,6 +1985,10 @@ public class ParallelEvaluatorTest {
final SkyKey otherKey = GraphTester.toSkyKey("otherKey");
tester.getOrCreate(errorKey).setHasError(true);
final AtomicInteger numOtherInvocations = new AtomicInteger(0);
+
+ final AtomicReference<String> bogusInvocationCount = new AtomicReference<>(null);
+ final AtomicReference<String> nonNullValue = new AtomicReference<>(null);
+
tester.getOrCreate(otherKey).setBuilder(new SkyFunction() {
@Override
public SkyValue compute(SkyKey skyKey, Environment env) throws SkyFunctionException {
@@ -1995,8 +1999,13 @@ public class ParallelEvaluatorTest {
}
try {
SkyValue value = env.getValueOrThrow(errorKey, SomeErrorException.class);
- assertTrue("bogus non-null value " + value, value == null);
- assertEquals(1, invocations);
+ if (value != null) {
+ nonNullValue.set("bogus non-null value " + value);
+ }
+ if (invocations != 1) {
+ bogusInvocationCount.set("bogus invocation count: " + invocations);
+ }
+
otherDone.countDown();
throw new GenericFunctionException(new SomeErrorException("other"),
Transience.PERSISTENT);
@@ -2023,6 +2032,8 @@ public class ParallelEvaluatorTest {
});
EvaluationResult<StringValue> result = eval(/*keepGoing=*/false,
ImmutableList.of(errorKey, otherKey));
+ assertTrue(nonNullValue.get(), nonNullValue.get() == null);
+ assertTrue(bogusInvocationCount.get(), bogusInvocationCount.get() == null);
assertEquals(null, graph.get(otherKey));
assertTrue(result.hasError());
assertEquals(errorKey, result.getError().getRootCauseOfException());