diff options
author | 2018-02-26 15:54:57 -0800 | |
---|---|---|
committer | 2018-02-26 15:57:11 -0800 | |
commit | 0175ce3630f15262172731e00e8413c534ed6a62 (patch) | |
tree | 3adaa426206428f314dba5a0a4721f032ec1abc4 /src/test/java/com/google/devtools/build/lib/actions | |
parent | 8cfc6cd2f1165e52b28a858b849463998c0aa73d (diff) |
Fail gracefully on conflicting actions generated by an aspect. These can come from Skylark, so we shouldn't crash. As a safety measure, subclasses of ActionLookupValue are now responsible for detecting action conflicts themselves.
PiperOrigin-RevId: 187095271
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/actions')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/actions/ActionLookupValueTest.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/actions/ActionLookupValueTest.java b/src/test/java/com/google/devtools/build/lib/actions/ActionLookupValueTest.java index e2ddd4f55f..f6c5961941 100644 --- a/src/test/java/com/google/devtools/build/lib/actions/ActionLookupValueTest.java +++ b/src/test/java/com/google/devtools/build/lib/actions/ActionLookupValueTest.java @@ -20,6 +20,7 @@ import static org.mockito.Mockito.when; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; +import com.google.devtools.build.lib.actions.MutableActionGraph.ActionConflictException; import com.google.devtools.build.lib.vfs.FileSystem; import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.lib.vfs.PathFragment; @@ -47,7 +48,7 @@ public class ActionLookupValueTest { Artifact artifact = mock(Artifact.class); when(action.getOutputs()).thenReturn(ImmutableSet.of(artifact)); when(action.canRemoveAfterExecution()).thenReturn(true); - ActionLookupValue underTest = new ActionLookupValue(actionKeyContext, action, false); + ActionLookupValue underTest = new ActionLookupValue(action, false); assertThat(underTest.getGeneratingActionIndex(artifact)).isEqualTo(0); assertThat(underTest.getAction(0)).isSameAs(action); underTest.actionEvaluated(0, action); @@ -55,7 +56,7 @@ public class ActionLookupValueTest { } @Test - public void testActionNotPresentAfterEvaluation() { + public void testActionNotPresentAfterEvaluation() throws ActionConflictException { Path execRoot = fs.getPath("/execroot"); Path outputRootPath = execRoot.getRelative("blaze-out"); ArtifactRoot root = ArtifactRoot.asDerivedRoot(execRoot, outputRootPath); @@ -69,7 +70,9 @@ public class ActionLookupValueTest { when(persistentAction.canRemoveAfterExecution()).thenReturn(false); ActionLookupValue underTest = new ActionLookupValue( - actionKeyContext, ImmutableList.of(normalAction, persistentAction), true); + Actions.filterSharedActionsAndThrowActionConflict( + actionKeyContext, ImmutableList.of(normalAction, persistentAction)), + true); assertThat(underTest.getGeneratingActionIndex(normalArtifact)).isEqualTo(0); assertThat(underTest.getAction(0)).isSameAs(normalAction); assertThat(underTest.getGeneratingActionIndex(persistentOutput)).isEqualTo(1); |