Search in sources :

Example 6 with ActionConflictException

use of com.google.devtools.build.lib.actions.MutableActionGraph.ActionConflictException in project bazel by bazelbuild.

the class ActionTemplateExpansionFunctionTest method testThrowsOnActionConflict.

@Test
public void testThrowsOnActionConflict() throws Exception {
    Artifact inputTreeArtifact = createAndPopulateTreeArtifact("inputTreeArtifact", "child0", "child1", "child2");
    Artifact outputTreeArtifact = createTreeArtifact("outputTreeArtifact");
    OutputPathMapper mapper = new OutputPathMapper() {

        @Override
        public PathFragment parentRelativeOutputPath(TreeFileArtifact inputTreeFileArtifact) {
            return new PathFragment("conflict_path");
        }
    };
    SpawnActionTemplate spawnActionTemplate = new SpawnActionTemplate.Builder(inputTreeArtifact, outputTreeArtifact).setExecutable(new PathFragment("/bin/cp")).setCommandLineTemplate(CustomCommandLine.builder().build()).setOutputPathMapper(mapper).build(ActionsTestUtil.NULL_ACTION_OWNER);
    try {
        evaluate(spawnActionTemplate);
        fail("Expected ActionConflictException");
    } catch (ActionConflictException e) {
    // Expected ActionConflictException
    }
}
Also used : TreeFileArtifact(com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact) ActionConflictException(com.google.devtools.build.lib.actions.MutableActionGraph.ActionConflictException) OutputPathMapper(com.google.devtools.build.lib.analysis.actions.SpawnActionTemplate.OutputPathMapper) PathFragment(com.google.devtools.build.lib.vfs.PathFragment) SpawnActionTemplate(com.google.devtools.build.lib.analysis.actions.SpawnActionTemplate) SpecialArtifact(com.google.devtools.build.lib.actions.Artifact.SpecialArtifact) Artifact(com.google.devtools.build.lib.actions.Artifact) OwnedArtifact(com.google.devtools.build.lib.skyframe.ArtifactSkyKey.OwnedArtifact) TreeFileArtifact(com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact) Test(org.junit.Test)

Aggregations

ActionConflictException (com.google.devtools.build.lib.actions.MutableActionGraph.ActionConflictException)6 ActionAnalysisMetadata (com.google.devtools.build.lib.actions.ActionAnalysisMetadata)4 Artifact (com.google.devtools.build.lib.actions.Artifact)4 ArtifactPrefixConflictException (com.google.devtools.build.lib.actions.ArtifactPrefixConflictException)4 ImmutableMap (com.google.common.collect.ImmutableMap)3 Map (java.util.Map)3 TreeFileArtifact (com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact)2 MutableActionGraph (com.google.devtools.build.lib.actions.MutableActionGraph)2 ConfiguredTarget (com.google.devtools.build.lib.analysis.ConfiguredTarget)2 PathFragment (com.google.devtools.build.lib.vfs.PathFragment)2 SortedMap (java.util.SortedMap)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 ConcurrentMap (java.util.concurrent.ConcurrentMap)2 ConcurrentNavigableMap (java.util.concurrent.ConcurrentNavigableMap)2 ConcurrentSkipListMap (java.util.concurrent.ConcurrentSkipListMap)2 Action (com.google.devtools.build.lib.actions.Action)1 ActionExecutionException (com.google.devtools.build.lib.actions.ActionExecutionException)1 ActionGraph (com.google.devtools.build.lib.actions.ActionGraph)1 AlreadyReportedActionExecutionException (com.google.devtools.build.lib.actions.AlreadyReportedActionExecutionException)1 SpecialArtifact (com.google.devtools.build.lib.actions.Artifact.SpecialArtifact)1