diff options
author | tomlu <tomlu@google.com> | 2018-01-15 17:40:35 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-01-15 17:42:23 -0800 |
commit | 89eaee567429b559ca9983fff146ae60477688ad (patch) | |
tree | 9364b8881e424d61c585a950b299b60b3b7c19ec /src/test/java/com/google/devtools/build/lib/actions/MapBasedActionGraphTest.java | |
parent | 15b532652e446472d6a61af1ba73c8aca170500d (diff) |
Remove use of Root#asDerivedRoot where the derived root == exec root.
This method violates the invariant that derived roots are never equal to the exec root. Only source roots can be equal to the exec root.
Note that this method was only used in tests, so this CL should be completely safe as long as its tests pass.
PiperOrigin-RevId: 181998483
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/actions/MapBasedActionGraphTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/actions/MapBasedActionGraphTest.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/actions/MapBasedActionGraphTest.java b/src/test/java/com/google/devtools/build/lib/actions/MapBasedActionGraphTest.java index ab0cc4a324..7d4a75201e 100644 --- a/src/test/java/com/google/devtools/build/lib/actions/MapBasedActionGraphTest.java +++ b/src/test/java/com/google/devtools/build/lib/actions/MapBasedActionGraphTest.java @@ -42,15 +42,16 @@ public class MapBasedActionGraphTest { @Test public void testSmoke() throws Exception { MutableActionGraph actionGraph = new MapBasedActionGraph(actionKeyContext); + Path execRoot = fileSystem.getPath("/"); Path root = fileSystem.getPath("/root"); Path path = root.getRelative("foo"); - Artifact output = new Artifact(path, Root.asDerivedRoot(root)); + Artifact output = new Artifact(path, Root.asDerivedRoot(execRoot, root)); Action action = new TestAction(TestAction.NO_EFFECT, ImmutableSet.<Artifact>of(), ImmutableSet.of(output)); actionGraph.registerAction(action); actionGraph.unregisterAction(action); path = root.getRelative("bar"); - output = new Artifact(path, Root.asDerivedRoot(root)); + output = new Artifact(path, Root.asDerivedRoot(execRoot, root)); Action action2 = new TestAction(TestAction.NO_EFFECT, ImmutableSet.<Artifact>of(), ImmutableSet.of(output)); actionGraph.registerAction(action); @@ -61,9 +62,10 @@ public class MapBasedActionGraphTest { @Test public void testNoActionConflictWhenUnregisteringSharedAction() throws Exception { MutableActionGraph actionGraph = new MapBasedActionGraph(actionKeyContext); + Path execRoot = fileSystem.getPath("/"); Path root = fileSystem.getPath("/root"); Path path = root.getRelative("/root/foo"); - Artifact output = new Artifact(path, Root.asDerivedRoot(root)); + Artifact output = new Artifact(path, Root.asDerivedRoot(execRoot, root)); Action action = new TestAction(TestAction.NO_EFFECT, ImmutableSet.<Artifact>of(), ImmutableSet.of(output)); actionGraph.registerAction(action); @@ -89,9 +91,10 @@ public class MapBasedActionGraphTest { "action-graph-test", AbstractQueueVisitor.EXECUTOR_FACTORY, ErrorClassifier.DEFAULT); + Path execRoot = fileSystem.getPath("/"); Path root = fileSystem.getPath("/root"); Path path = root.getRelative("foo"); - output = new Artifact(path, Root.asDerivedRoot(root)); + output = new Artifact(path, Root.asDerivedRoot(execRoot, root)); allActions.add(new TestAction( TestAction.NO_EFFECT, ImmutableSet.<Artifact>of(), ImmutableSet.of(output))); } |