diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java b/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java index f82719dfaf..4e666dc256 100644 --- a/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java +++ b/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java @@ -1645,8 +1645,7 @@ public class MemoizingEvaluatorTest { /** * Regression test: tests that pass before other build actions fail yield crash in non -k builds. */ - @Test - public void passThenFailToBuild() throws Exception { + private void passThenFailToBuild(boolean successFirst) throws Exception { CountDownLatch blocker = new CountDownLatch(1); SkyKey successKey = GraphTester.toSkyKey("success"); tester.getOrCreate(successKey).setBuilder( @@ -1659,30 +1658,26 @@ public class MemoizingEvaluatorTest { /*notifyFinish=*/null, /*waitForException=*/false, /*value=*/null, /*deps=*/ImmutableList.<SkyKey>of())); - EvaluationResult<StringValue> result = tester.eval( - /*keepGoing=*/false, successKey, slowFailKey); - assertThat(result.getError().getRootCauses()).containsExactly(slowFailKey); + EvaluationResult<StringValue> result; + if (successFirst) { + result = tester.eval(/*keepGoing=*/ false, successKey, slowFailKey); + } else { + result = tester.eval(/*keepGoing=*/ false, slowFailKey, successKey); + } + assertThatEvaluationResult(result) + .hasErrorEntryForKeyThat(slowFailKey) + .rootCauseOfExceptionIs(slowFailKey); assertThat(result.values()).containsExactly(new StringValue("yippee")); } @Test - public void passThenFailToBuildAlternateOrder() throws Exception { - CountDownLatch blocker = new CountDownLatch(1); - SkyKey successKey = GraphTester.toSkyKey("success"); - tester.getOrCreate(successKey).setBuilder( - new ChainedFunction(/*notifyStart=*/null, /*waitToFinish=*/null, - /*notifyFinish=*/blocker, /*waitForException=*/false, new StringValue("yippee"), - /*deps=*/ImmutableList.<SkyKey>of())); - SkyKey slowFailKey = GraphTester.toSkyKey("slow_then_fail"); - tester.getOrCreate(slowFailKey).setBuilder( - new ChainedFunction(/*notifyStart=*/null, /*waitToFinish=*/blocker, - /*notifyFinish=*/null, /*waitForException=*/false, /*value=*/null, - /*deps=*/ImmutableList.<SkyKey>of())); + public void passThenFailToBuild() throws Exception { + passThenFailToBuild(true); + } - EvaluationResult<StringValue> result = tester.eval( - /*keepGoing=*/false, slowFailKey, successKey); - assertThat(result.getError().getRootCauses()).containsExactly(slowFailKey); - assertThat(result.values()).containsExactly(new StringValue("yippee")); + @Test + public void passThenFailToBuildAlternateOrder() throws Exception { + passThenFailToBuild(false); } @Test |