diff options
author | 2018-01-15 17:40:35 -0800 | |
---|---|---|
committer | 2018-01-15 17:42:23 -0800 | |
commit | 89eaee567429b559ca9983fff146ae60477688ad (patch) | |
tree | 9364b8881e424d61c585a950b299b60b3b7c19ec /src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.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/rules/cpp/CppLinkActionTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java index 71fd9694a5..6107747ffe 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java @@ -531,10 +531,11 @@ public class CppLinkActionTest extends BuildViewTestCase { } private Artifact scratchArtifact(String s) { + Path execRoot = outputBase.getRelative("exec"); + Path outputRoot = execRoot.getRelative("out"); + Root root = Root.asDerivedRoot(execRoot, outputRoot); try { - return new Artifact( - scratch.overwriteFile(outputBase.getRelative("WORKSPACE").getRelative(s).toString()), - Root.asDerivedRoot(scratch.dir(outputBase.getRelative("WORKSPACE").toString()))); + return new Artifact(scratch.overwriteFile(outputRoot.getRelative(s).toString()), root); } catch (IOException e) { throw new RuntimeException(e); } @@ -618,7 +619,7 @@ public class CppLinkActionTest extends BuildViewTestCase { assertThat(commandLine.get(1)).isEqualTo("yes"); assertThat(commandLine.get(2)).endsWith("tools/cpp/build_interface_so"); assertThat(commandLine.get(3)).endsWith("foo.so"); - assertThat(commandLine.get(4)).isEqualTo("FakeInterfaceOutput.ifso"); + assertThat(commandLine.get(4)).isEqualTo("out/FakeInterfaceOutput.ifso"); assertThat(commandLine.get(5)).isEqualTo("dynamic_library_linker_tool"); } |