diff options
author | 2016-01-04 04:47:44 +0000 | |
---|---|---|
committer | 2016-01-04 12:59:05 +0000 | |
commit | 900acfbc0d84cac1933ebb28ac1ec8cb47f1f84d (patch) | |
tree | 7c65460605636b1d0000f0e4cebf06568240386e /src/test/java/com/google/devtools/build | |
parent | 0e72b69d0df6924537e8c4dd996c10c53586902c (diff) |
Add catastrophe field to EvaluationResult so that callers can identify the cause of a catastrophic failure (this is distinct from a crash).
Also clean up catastrophe logic in ParallelEvaluator -- the catastrophic nature of an exception is important only if the build is keep_going, and only if the exception is catastrophic can we have an exception in the first place.
--
MOS_MIGRATED_REVID=111293164
Diffstat (limited to 'src/test/java/com/google/devtools/build')
-rw-r--r-- | src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java | 40 |
1 files changed, 22 insertions, 18 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 55b3bb982f..95f9e4057f 100644 --- a/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java +++ b/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java @@ -556,25 +556,28 @@ public class ParallelEvaluatorTest { SkyKey catastropheKey = GraphTester.toSkyKey("catastrophe"); SkyKey otherKey = GraphTester.toSkyKey("someKey"); - tester.getOrCreate(catastropheKey).setBuilder(new SkyFunction() { - @Nullable - @Override - public SkyValue compute(SkyKey skyKey, Environment env) throws SkyFunctionException { - throw new SkyFunctionException(new SomeErrorException("bad"), - Transience.PERSISTENT) { - @Override - public boolean isCatastrophic() { - return true; - } - }; - } + final Exception catastrophe = new SomeErrorException("bad"); + tester + .getOrCreate(catastropheKey) + .setBuilder( + new SkyFunction() { + @Nullable + @Override + public SkyValue compute(SkyKey skyKey, Environment env) throws SkyFunctionException { + throw new SkyFunctionException(catastrophe, Transience.PERSISTENT) { + @Override + public boolean isCatastrophic() { + return true; + } + }; + } - @Nullable - @Override - public String extractTag(SkyKey skyKey) { - return null; - } - }); + @Nullable + @Override + public String extractTag(SkyKey skyKey) { + return null; + } + }); tester.getOrCreate(otherKey).setBuilder(new SkyFunction() { @Nullable @@ -600,6 +603,7 @@ public class ParallelEvaluatorTest { } else { assertTrue(result.hasError()); assertThat(result.errorMap()).isEmpty(); + assertThat(result.getCatastrophe()).isSameAs(catastrophe); } } |