From e483df35c30cfb7b77fe46b9c2dee8114d4b5748 Mon Sep 17 00:00:00 2001 From: shahan Date: Thu, 5 Apr 2018 08:03:04 -0700 Subject: Avoids calling getPath() in Artifact.toDetailString(). Also deletes obsolete Artifact.serializeToString() method. "Semantic" change: replaces the actual exec root with in the toString() representation. PiperOrigin-RevId: 191742669 --- .../devtools/build/lib/actions/ArtifactTest.java | 37 ++-------------------- 1 file changed, 3 insertions(+), 34 deletions(-) (limited to 'src/test/java/com/google') diff --git a/src/test/java/com/google/devtools/build/lib/actions/ArtifactTest.java b/src/test/java/com/google/devtools/build/lib/actions/ArtifactTest.java index e7ead54483..ccec35005a 100644 --- a/src/test/java/com/google/devtools/build/lib/actions/ArtifactTest.java +++ b/src/test/java/com/google/devtools/build/lib/actions/ArtifactTest.java @@ -285,12 +285,12 @@ public class ArtifactTest { @Test public void testToDetailString() throws Exception { - Path execRoot = scratch.getFileSystem().getPath("/a"); + Path execRoot = scratch.getFileSystem().getPath("/execroot/workspace"); Artifact a = new Artifact( - ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/a/b")), + ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/execroot/workspace/b")), PathFragment.create("b/c")); - assertThat(a.toDetailString()).isEqualTo("[[/a]b]c"); + assertThat(a.toDetailString()).isEqualTo("[[]b]c"); } @Test @@ -303,37 +303,6 @@ public class ArtifactTest { ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/a")), PathFragment.create("c"))); } - @Test - public void testSerializeToString() throws Exception { - Path execRoot = scratch.getFileSystem().getPath("/"); - assertThat( - new Artifact( - scratch.file("/a/b/c"), ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/a"))) - .serializeToString()) - .isEqualTo("a/b/c /3"); - } - - @Test - public void testSerializeToStringWithExecPath() throws Exception { - Path execRoot = scratch.getFileSystem().getPath("/aaa"); - ArtifactRoot root = ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/aaa/bbb")); - PathFragment execPath = PathFragment.create("bbb/ccc"); - - assertThat(new Artifact(root, execPath).serializeToString()).isEqualTo("bbb/ccc /3"); - } - - @Test - public void testSerializeToStringWithOwner() throws Exception { - Path execRoot = scratch.getFileSystem().getPath("/aa"); - assertThat( - new Artifact( - ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/aa/b")), - PathFragment.create("b/c"), - new LabelArtifactOwner(Label.parseAbsoluteUnchecked("//foo:bar"))) - .serializeToString()) - .isEqualTo("b/c /1 //foo:bar"); - } - @Test public void testCodec() throws Exception { new SerializationTester( -- cgit v1.2.3