diff options
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/actions')
11 files changed, 101 insertions, 89 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/actions/ActionCacheCheckerTest.java b/src/test/java/com/google/devtools/build/lib/actions/ActionCacheCheckerTest.java index c6de33475e..8892fcf38d 100644 --- a/src/test/java/com/google/devtools/build/lib/actions/ActionCacheCheckerTest.java +++ b/src/test/java/com/google/devtools/build/lib/actions/ActionCacheCheckerTest.java @@ -274,15 +274,16 @@ public class ActionCacheCheckerTest { @Test public void testMiddleman_DifferentFiles() throws Exception { - Action action = new NullMiddlemanAction() { - @Override - public synchronized Iterable<Artifact> getInputs() { - FileSystem fileSystem = getPrimaryOutput().getPath().getFileSystem(); - Path path = fileSystem.getPath("/input"); - Root root = Root.asSourceRoot(fileSystem.getPath("/")); - return ImmutableList.of(new Artifact(path, root)); - } - }; + Action action = + new NullMiddlemanAction() { + @Override + public synchronized Iterable<Artifact> getInputs() { + FileSystem fileSystem = getPrimaryOutput().getPath().getFileSystem(); + Path path = fileSystem.getPath("/input"); + ArtifactRoot root = ArtifactRoot.asSourceRoot(fileSystem.getPath("/")); + return ImmutableList.of(new Artifact(path, root)); + } + }; runAction(action); // Not cached so recorded as different deps. FileSystemUtils.writeContentAsLatin1(action.getPrimaryInput().getPath(), "modified"); runAction(action); // Cache miss because input files were modified. 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 5ae6c377e5..e2ddd4f55f 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 @@ -58,7 +58,7 @@ public class ActionLookupValueTest { public void testActionNotPresentAfterEvaluation() { Path execRoot = fs.getPath("/execroot"); Path outputRootPath = execRoot.getRelative("blaze-out"); - Root root = Root.asDerivedRoot(execRoot, outputRootPath); + ArtifactRoot root = ArtifactRoot.asDerivedRoot(execRoot, outputRootPath); Action normalAction = mock(Action.class); Artifact normalArtifact = new Artifact(PathFragment.create("normal"), root); when(normalAction.getOutputs()).thenReturn(ImmutableSet.of(normalArtifact)); diff --git a/src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java b/src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java index 5c6005d1cb..94b1a0ffc4 100644 --- a/src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java +++ b/src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java @@ -50,10 +50,10 @@ public class ArtifactFactoryTest { private Scratch scratch = new Scratch(); private Path execRoot; - private Root clientRoot; - private Root clientRoRoot; - private Root alienRoot; - private Root outRoot; + private ArtifactRoot clientRoot; + private ArtifactRoot clientRoRoot; + private ArtifactRoot alienRoot; + private ArtifactRoot outRoot; private PathFragment fooPath; private PackageIdentifier fooPackage; @@ -73,10 +73,10 @@ public class ArtifactFactoryTest { @Before public final void createFiles() throws Exception { execRoot = scratch.dir("/output/workspace"); - clientRoot = Root.asSourceRoot(scratch.dir("/client/workspace")); - clientRoRoot = Root.asSourceRoot(scratch.dir("/client/RO/workspace")); - alienRoot = Root.asSourceRoot(scratch.dir("/client/workspace")); - outRoot = Root.asDerivedRoot(execRoot, execRoot.getRelative("out-root/x/bin")); + clientRoot = ArtifactRoot.asSourceRoot(scratch.dir("/client/workspace")); + clientRoRoot = ArtifactRoot.asSourceRoot(scratch.dir("/client/RO/workspace")); + alienRoot = ArtifactRoot.asSourceRoot(scratch.dir("/client/workspace")); + outRoot = ArtifactRoot.asDerivedRoot(execRoot, execRoot.getRelative("out-root/x/bin")); fooPath = PathFragment.create("foo"); fooPackage = PackageIdentifier.createInMainRepo(fooPath); @@ -95,7 +95,7 @@ public class ArtifactFactoryTest { } private void setupRoots() { - Map<PackageIdentifier, Root> packageRootMap = new HashMap<>(); + Map<PackageIdentifier, ArtifactRoot> packageRootMap = new HashMap<>(); packageRootMap.put(fooPackage, clientRoot); packageRootMap.put(barPackage, clientRoRoot); packageRootMap.put(alienPackage, alienRoot); @@ -155,8 +155,8 @@ public class ArtifactFactoryTest { public void testResolveArtifactWithUpLevelFailsCleanly() throws Exception { // We need a package in the root directory to make every exec path (even one with up-level // references) be in a package. - Map<PackageIdentifier, Root> packageRoots = ImmutableMap.of( - PackageIdentifier.createInMainRepo(PathFragment.create("")), clientRoot); + Map<PackageIdentifier, ArtifactRoot> packageRoots = + ImmutableMap.of(PackageIdentifier.createInMainRepo(PathFragment.create("")), clientRoot); artifactFactory.setPackageRoots(packageRoots::get); PathFragment outsideWorkspace = PathFragment.create("../foo"); PathFragment insideWorkspace = @@ -211,17 +211,18 @@ public class ArtifactFactoryTest { } private static class MockPackageRootResolver implements PackageRootResolver { - private Map<PathFragment, Root> packageRoots = Maps.newHashMap(); + private Map<PathFragment, ArtifactRoot> packageRoots = Maps.newHashMap(); - public void setPackageRoots(Map<PackageIdentifier, Root> packageRoots) { - for (Entry<PackageIdentifier, Root> packageRoot : packageRoots.entrySet()) { + public void setPackageRoots(Map<PackageIdentifier, ArtifactRoot> packageRoots) { + for (Entry<PackageIdentifier, ArtifactRoot> packageRoot : packageRoots.entrySet()) { this.packageRoots.put(packageRoot.getKey().getPackageFragment(), packageRoot.getValue()); } } @Override - public Map<PathFragment, Root> findPackageRootsForFiles(Iterable<PathFragment> execPaths) { - Map<PathFragment, Root> result = new HashMap<>(); + public Map<PathFragment, ArtifactRoot> findPackageRootsForFiles( + Iterable<PathFragment> execPaths) { + Map<PathFragment, ArtifactRoot> result = new HashMap<>(); for (PathFragment execPath : execPaths) { for (PathFragment dir = execPath.getParentDirectory(); dir != null; dir = dir.getParentDirectory()) { @@ -238,7 +239,7 @@ public class ArtifactFactoryTest { @Override @Nullable - public Map<PathFragment, Root> findPackageRoots(Iterable<PathFragment> execPaths) { + public Map<PathFragment, ArtifactRoot> findPackageRoots(Iterable<PathFragment> execPaths) { return null; // unused } } diff --git a/src/test/java/com/google/devtools/build/lib/actions/RootTest.java b/src/test/java/com/google/devtools/build/lib/actions/ArtifactRootTest.java index 36ede38c34..dfe4e0789a 100644 --- a/src/test/java/com/google/devtools/build/lib/actions/RootTest.java +++ b/src/test/java/com/google/devtools/build/lib/actions/ArtifactRootTest.java @@ -25,15 +25,15 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** Tests for {@link Root}. */ +/** Tests for {@link ArtifactRoot}. */ @RunWith(JUnit4.class) -public class RootTest { +public class ArtifactRootTest { private Scratch scratch = new Scratch(); @Test public void testAsSourceRoot() throws IOException { Path sourceDir = scratch.dir("/source"); - Root root = Root.asSourceRoot(sourceDir); + ArtifactRoot root = ArtifactRoot.asSourceRoot(sourceDir); assertThat(root.isSourceRoot()).isTrue(); assertThat(root.getExecPath()).isEqualTo(PathFragment.EMPTY_FRAGMENT); assertThat(root.getPath()).isEqualTo(sourceDir); @@ -43,7 +43,7 @@ public class RootTest { @Test public void testBadAsSourceRoot() { try { - Root.asSourceRoot(null); + ArtifactRoot.asSourceRoot(null); fail(); } catch (NullPointerException expected) { } @@ -53,7 +53,7 @@ public class RootTest { public void testAsDerivedRoot() throws IOException { Path execRoot = scratch.dir("/exec"); Path rootDir = scratch.dir("/exec/root"); - Root root = Root.asDerivedRoot(execRoot, rootDir); + ArtifactRoot root = ArtifactRoot.asDerivedRoot(execRoot, rootDir); assertThat(root.isSourceRoot()).isFalse(); assertThat(root.getExecPath()).isEqualTo(PathFragment.create("root")); assertThat(root.getPath()).isEqualTo(rootDir); @@ -65,7 +65,7 @@ public class RootTest { try { Path execRoot = scratch.dir("/exec"); Path outsideDir = scratch.dir("/not_exec"); - Root.asDerivedRoot(execRoot, outsideDir); + ArtifactRoot.asDerivedRoot(execRoot, outsideDir); fail(); } catch (IllegalArgumentException expected) { } @@ -75,7 +75,7 @@ public class RootTest { public void testBadAsDerivedRootSameForBoth() throws IOException { try { Path execRoot = scratch.dir("/exec"); - Root.asDerivedRoot(execRoot, execRoot); + ArtifactRoot.asDerivedRoot(execRoot, execRoot); fail(); } catch (IllegalArgumentException expected) { } @@ -85,7 +85,7 @@ public class RootTest { public void testBadAsDerivedRootNullDir() throws IOException { try { Path execRoot = scratch.dir("/exec"); - Root.asDerivedRoot(execRoot, null); + ArtifactRoot.asDerivedRoot(execRoot, null); fail(); } catch (NullPointerException expected) { } @@ -95,7 +95,7 @@ public class RootTest { public void testBadAsDerivedRootNullExecRoot() throws IOException { try { Path execRoot = scratch.dir("/exec"); - Root.asDerivedRoot(null, execRoot); + ArtifactRoot.asDerivedRoot(null, execRoot); fail(); } catch (NullPointerException expected) { } @@ -107,11 +107,11 @@ public class RootTest { Path rootDir = scratch.dir("/exec/root"); Path otherRootDir = scratch.dir("/"); Path sourceDir = scratch.dir("/source"); - Root rootA = Root.asDerivedRoot(execRoot, rootDir); - assertEqualsAndHashCode(true, rootA, Root.asDerivedRoot(execRoot, rootDir)); - assertEqualsAndHashCode(false, rootA, Root.asSourceRoot(sourceDir)); - assertEqualsAndHashCode(false, rootA, Root.asSourceRoot(rootDir)); - assertEqualsAndHashCode(false, rootA, Root.asDerivedRoot(otherRootDir, rootDir)); + ArtifactRoot rootA = ArtifactRoot.asDerivedRoot(execRoot, rootDir); + assertEqualsAndHashCode(true, rootA, ArtifactRoot.asDerivedRoot(execRoot, rootDir)); + assertEqualsAndHashCode(false, rootA, ArtifactRoot.asSourceRoot(sourceDir)); + assertEqualsAndHashCode(false, rootA, ArtifactRoot.asSourceRoot(rootDir)); + assertEqualsAndHashCode(false, rootA, ArtifactRoot.asDerivedRoot(otherRootDir, rootDir)); } public void assertEqualsAndHashCode(boolean expected, Object a, Object b) { 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 dda385f813..681b2a30a8 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 @@ -40,14 +40,14 @@ import org.junit.runners.JUnit4; public class ArtifactTest { private Scratch scratch; private Path execDir; - private Root rootDir; + private ArtifactRoot rootDir; private final ActionKeyContext actionKeyContext = new ActionKeyContext(); @Before public final void setRootDir() throws Exception { scratch = new Scratch(); execDir = scratch.dir("/exec"); - rootDir = Root.asDerivedRoot(execDir, scratch.dir("/exec/root")); + rootDir = ArtifactRoot.asDerivedRoot(execDir, scratch.dir("/exec/root")); } @Test @@ -55,7 +55,7 @@ public class ArtifactTest { Path f1 = scratch.file("/exec/dir/file.ext"); Path bogusDir = scratch.file("/exec/dir/bogus"); try { - new Artifact(f1, Root.asDerivedRoot(execDir, bogusDir), f1.relativeTo(execDir)); + new Artifact(f1, ArtifactRoot.asDerivedRoot(execDir, bogusDir), f1.relativeTo(execDir)); fail("Expected IllegalArgumentException constructing artifact with a bad root dir"); } catch (IllegalArgumentException expected) {} } @@ -97,7 +97,7 @@ public class ArtifactTest { @Test public void testRootPrefixedExecPath_noRoot() throws IOException { Path f1 = scratch.file("/exec/dir/file.ext"); - Artifact a1 = new Artifact(f1.relativeTo(execDir), Root.asSourceRoot(execDir)); + Artifact a1 = new Artifact(f1.relativeTo(execDir), ArtifactRoot.asSourceRoot(execDir)); assertThat(Artifact.asRootPrefixedExecPath(a1)).isEqualTo(":dir/file.ext"); } @@ -128,7 +128,7 @@ public class ArtifactTest { @Test public void testGetFilename() throws Exception { - Root root = Root.asSourceRoot(scratch.dir("/foo")); + ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.dir("/foo")); Artifact javaFile = new Artifact(scratch.file("/foo/Bar.java"), root); Artifact generatedHeader = new Artifact(scratch.file("/foo/bar.proto.h"), root); Artifact generatedCc = new Artifact(scratch.file("/foo/bar.proto.cc"), root); @@ -141,7 +141,7 @@ public class ArtifactTest { @Test public void testGetExtension() throws Exception { - Root root = Root.asSourceRoot(scratch.dir("/foo")); + ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.dir("/foo")); Artifact javaFile = new Artifact(scratch.file("/foo/Bar.java"), root); assertThat(javaFile.getExtension()).isEqualTo("java"); } @@ -154,12 +154,14 @@ public class ArtifactTest { private List<Artifact> getFooBarArtifacts(MutableActionGraph actionGraph, boolean collapsedList) throws Exception { - Root root = Root.asSourceRoot(scratch.dir("/foo")); + ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.dir("/foo")); Artifact aHeader1 = new Artifact(scratch.file("/foo/bar1.h"), root); Artifact aHeader2 = new Artifact(scratch.file("/foo/bar2.h"), root); Artifact aHeader3 = new Artifact(scratch.file("/foo/bar3.h"), root); - Artifact middleman = new Artifact(PathFragment.create("middleman"), - Root.middlemanRoot(scratch.dir("/foo"), scratch.dir("/foo/out"))); + Artifact middleman = + new Artifact( + PathFragment.create("middleman"), + ArtifactRoot.middlemanRoot(scratch.dir("/foo"), scratch.dir("/foo/out"))); actionGraph.registerAction(new MiddlemanAction(ActionsTestUtil.NULL_ACTION_OWNER, ImmutableList.of(aHeader1, aHeader2, aHeader3), middleman, "desc", MiddlemanType.AGGREGATING_MIDDLEMAN)); @@ -270,7 +272,7 @@ public class ArtifactTest { @Test public void testRootRelativePathIsSameAsExecPath() throws Exception { - Root root = Root.asSourceRoot(scratch.dir("/foo")); + ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.dir("/foo")); Artifact a = new Artifact(scratch.file("/foo/bar1.h"), root); assertThat(a.getRootRelativePath()).isSameAs(a.getExecPath()); } @@ -281,7 +283,7 @@ public class ArtifactTest { Artifact a = new Artifact( scratch.file("/a/b/c"), - Root.asDerivedRoot(execRoot, scratch.dir("/a/b")), + ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/a/b")), PathFragment.create("b/c")); assertThat(a.toDetailString()).isEqualTo("[[/a]b]c"); } @@ -292,7 +294,7 @@ public class ArtifactTest { Path execRoot = scratch.getFileSystem().getPath("/"); new Artifact( scratch.file("/a/b/c"), - Root.asDerivedRoot(execRoot, scratch.dir("/a")), + ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/a")), PathFragment.create("c")); fail(); } catch (IllegalArgumentException e) { @@ -305,7 +307,8 @@ public class ArtifactTest { public void testSerializeToString() throws Exception { Path execRoot = scratch.getFileSystem().getPath("/"); assertThat( - new Artifact(scratch.file("/a/b/c"), Root.asDerivedRoot(execRoot, scratch.dir("/a"))) + new Artifact( + scratch.file("/a/b/c"), ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/a"))) .serializeToString()) .isEqualTo("a/b/c /3"); } @@ -314,7 +317,7 @@ public class ArtifactTest { public void testSerializeToStringWithExecPath() throws Exception { Path execRoot = scratch.getFileSystem().getPath("/"); Path path = scratch.file("/aaa/bbb/ccc"); - Root root = Root.asDerivedRoot(execRoot, scratch.dir("/aaa/bbb")); + ArtifactRoot root = ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/aaa/bbb")); PathFragment execPath = PathFragment.create("bbb/ccc"); assertThat(new Artifact(path, root, execPath).serializeToString()).isEqualTo("bbb/ccc /3"); @@ -326,7 +329,7 @@ public class ArtifactTest { assertThat( new Artifact( scratch.file("/aa/b/c"), - Root.asDerivedRoot(execRoot, scratch.dir("/aa")), + ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/aa")), PathFragment.create("b/c"), new LabelArtifactOwner(Label.parseAbsoluteUnchecked("//foo:bar"))) .serializeToString()) @@ -343,7 +346,7 @@ public class ArtifactTest { @Test public void testDirnameInExecutionDir() throws Exception { Artifact artifact = - new Artifact(scratch.file("/foo/bar.txt"), Root.asSourceRoot(scratch.dir("/foo"))); + new Artifact(scratch.file("/foo/bar.txt"), ArtifactRoot.asSourceRoot(scratch.dir("/foo"))); assertThat(artifact.getDirname()).isEqualTo("."); } @@ -360,26 +363,30 @@ public class ArtifactTest { @Test public void testIsSourceArtifact() throws Exception { assertThat( - new Artifact(scratch.file("/src/foo.cc"), Root.asSourceRoot(scratch.dir("/")), - PathFragment.create("src/foo.cc")) - .isSourceArtifact()) + new Artifact( + scratch.file("/src/foo.cc"), + ArtifactRoot.asSourceRoot(scratch.dir("/")), + PathFragment.create("src/foo.cc")) + .isSourceArtifact()) .isTrue(); assertThat( - new Artifact(scratch.file("/genfiles/aaa/bar.out"), - Root.asDerivedRoot(scratch.dir("/genfiles"), scratch.dir("/genfiles/aaa"))) - .isSourceArtifact()) + new Artifact( + scratch.file("/genfiles/aaa/bar.out"), + ArtifactRoot.asDerivedRoot( + scratch.dir("/genfiles"), scratch.dir("/genfiles/aaa"))) + .isSourceArtifact()) .isFalse(); - } @Test public void testGetRoot() throws Exception { Path execRoot = scratch.getFileSystem().getPath("/"); - Root root = Root.asDerivedRoot(execRoot, scratch.dir("/newRoot")); + ArtifactRoot root = ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/newRoot")); assertThat(new Artifact(scratch.file("/newRoot/foo"), root).getRoot()).isEqualTo(root); } private Artifact createDirNameArtifact() throws Exception { - return new Artifact(scratch.file("/aaa/bbb/ccc/ddd"), Root.asSourceRoot(scratch.dir("/"))); + return new Artifact( + scratch.file("/aaa/bbb/ccc/ddd"), ArtifactRoot.asSourceRoot(scratch.dir("/"))); } } diff --git a/src/test/java/com/google/devtools/build/lib/actions/CompositeRunfilesSupplierTest.java b/src/test/java/com/google/devtools/build/lib/actions/CompositeRunfilesSupplierTest.java index e799800806..dc6f752771 100644 --- a/src/test/java/com/google/devtools/build/lib/actions/CompositeRunfilesSupplierTest.java +++ b/src/test/java/com/google/devtools/build/lib/actions/CompositeRunfilesSupplierTest.java @@ -40,13 +40,13 @@ public class CompositeRunfilesSupplierTest { private RunfilesSupplier mockSecond; private Path execRoot; - private Root rootDir; + private ArtifactRoot rootDir; @Before public final void createMocks() throws IOException { Scratch scratch = new Scratch(); execRoot = scratch.getFileSystem().getPath("/"); - rootDir = Root.asDerivedRoot(execRoot, scratch.dir("/fake/root/dont/matter")); + rootDir = ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/fake/root/dont/matter")); mockFirst = mock(RunfilesSupplier.class); mockSecond = mock(RunfilesSupplier.class); @@ -131,7 +131,7 @@ public class CompositeRunfilesSupplierTest { shared, firstSharedMappings); } - private static Map<PathFragment, Artifact> mkMappings(Root rootDir, String... paths) { + private static Map<PathFragment, Artifact> mkMappings(ArtifactRoot rootDir, String... paths) { ImmutableMap.Builder<PathFragment, Artifact> builder = ImmutableMap.builder(); for (String path : paths) { builder.put(PathFragment.create(path), mkArtifact(rootDir, path)); @@ -139,11 +139,11 @@ public class CompositeRunfilesSupplierTest { return builder.build(); } - private static Artifact mkArtifact(Root rootDir, String path) { + private static Artifact mkArtifact(ArtifactRoot rootDir, String path) { return new Artifact(PathFragment.create(path), rootDir); } - private static List<Artifact> mkArtifacts(Root rootDir, String... paths) { + private static List<Artifact> mkArtifacts(ArtifactRoot rootDir, String... paths) { ImmutableList.Builder<Artifact> builder = ImmutableList.builder(); for (String path : paths) { builder.add(mkArtifact(rootDir, path)); diff --git a/src/test/java/com/google/devtools/build/lib/actions/CustomCommandLineTest.java b/src/test/java/com/google/devtools/build/lib/actions/CustomCommandLineTest.java index a907739d98..5227dba353 100644 --- a/src/test/java/com/google/devtools/build/lib/actions/CustomCommandLineTest.java +++ b/src/test/java/com/google/devtools/build/lib/actions/CustomCommandLineTest.java @@ -44,14 +44,14 @@ import org.junit.runners.JUnit4; public class CustomCommandLineTest { private Scratch scratch; - private Root rootDir; + private ArtifactRoot rootDir; private Artifact artifact1; private Artifact artifact2; @Before public void createArtifacts() throws Exception { scratch = new Scratch(); - rootDir = Root.asSourceRoot(scratch.dir("/exec/root")); + rootDir = ArtifactRoot.asSourceRoot(scratch.dir("/exec/root")); artifact1 = new Artifact(scratch.file("/exec/root/dir/file1.txt"), rootDir); artifact2 = new Artifact(scratch.file("/exec/root/dir/file2.txt"), rootDir); } diff --git a/src/test/java/com/google/devtools/build/lib/actions/ExecutableSymlinkActionTest.java b/src/test/java/com/google/devtools/build/lib/actions/ExecutableSymlinkActionTest.java index 391ccf5441..28da727027 100644 --- a/src/test/java/com/google/devtools/build/lib/actions/ExecutableSymlinkActionTest.java +++ b/src/test/java/com/google/devtools/build/lib/actions/ExecutableSymlinkActionTest.java @@ -35,8 +35,8 @@ import org.junit.runners.JUnit4; @RunWith(JUnit4.class) public class ExecutableSymlinkActionTest { private Scratch scratch = new Scratch(); - private Root inputRoot; - private Root outputRoot; + private ArtifactRoot inputRoot; + private ArtifactRoot outputRoot; TestFileOutErr outErr; private Executor executor; private final ActionKeyContext actionKeyContext = new ActionKeyContext(); @@ -45,8 +45,8 @@ public class ExecutableSymlinkActionTest { public final void createExecutor() throws Exception { final Path inputDir = scratch.dir("/in"); Path execRoot = scratch.getFileSystem().getPath("/"); - inputRoot = Root.asDerivedRoot(execRoot, inputDir); - outputRoot = Root.asDerivedRoot(execRoot, scratch.dir("/out")); + inputRoot = ArtifactRoot.asDerivedRoot(execRoot, inputDir); + outputRoot = ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/out")); outErr = new TestFileOutErr(); executor = new DummyExecutor(scratch.getFileSystem(), inputDir); } diff --git a/src/test/java/com/google/devtools/build/lib/actions/FailActionTest.java b/src/test/java/com/google/devtools/build/lib/actions/FailActionTest.java index 5b39c35909..c1eac8e3de 100644 --- a/src/test/java/com/google/devtools/build/lib/actions/FailActionTest.java +++ b/src/test/java/com/google/devtools/build/lib/actions/FailActionTest.java @@ -42,8 +42,10 @@ public class FailActionTest { @Before public final void setUp() throws Exception { errorMessage = "An error just happened."; - anOutput = new Artifact(scratch.file("/out/foo"), - Root.asDerivedRoot(scratch.dir("/"), scratch.dir("/out"))); + anOutput = + new Artifact( + scratch.file("/out/foo"), + ArtifactRoot.asDerivedRoot(scratch.dir("/"), scratch.dir("/out"))); outputs = ImmutableList.of(anOutput); failAction = new FailAction(NULL_ACTION_OWNER, outputs, errorMessage); actionGraph.registerAction(failAction); 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 7d4a75201e..5de14d956c 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 @@ -45,13 +45,13 @@ public class MapBasedActionGraphTest { Path execRoot = fileSystem.getPath("/"); Path root = fileSystem.getPath("/root"); Path path = root.getRelative("foo"); - Artifact output = new Artifact(path, Root.asDerivedRoot(execRoot, root)); + Artifact output = new Artifact(path, ArtifactRoot.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(execRoot, root)); + output = new Artifact(path, ArtifactRoot.asDerivedRoot(execRoot, root)); Action action2 = new TestAction(TestAction.NO_EFFECT, ImmutableSet.<Artifact>of(), ImmutableSet.of(output)); actionGraph.registerAction(action); @@ -65,7 +65,7 @@ public class MapBasedActionGraphTest { Path execRoot = fileSystem.getPath("/"); Path root = fileSystem.getPath("/root"); Path path = root.getRelative("/root/foo"); - Artifact output = new Artifact(path, Root.asDerivedRoot(execRoot, root)); + Artifact output = new Artifact(path, ArtifactRoot.asDerivedRoot(execRoot, root)); Action action = new TestAction(TestAction.NO_EFFECT, ImmutableSet.<Artifact>of(), ImmutableSet.of(output)); actionGraph.registerAction(action); @@ -94,7 +94,7 @@ public class MapBasedActionGraphTest { Path execRoot = fileSystem.getPath("/"); Path root = fileSystem.getPath("/root"); Path path = root.getRelative("foo"); - output = new Artifact(path, Root.asDerivedRoot(execRoot, root)); + output = new Artifact(path, ArtifactRoot.asDerivedRoot(execRoot, root)); allActions.add(new TestAction( TestAction.NO_EFFECT, ImmutableSet.<Artifact>of(), ImmutableSet.of(output))); } diff --git a/src/test/java/com/google/devtools/build/lib/actions/util/ActionsTestUtil.java b/src/test/java/com/google/devtools/build/lib/actions/util/ActionsTestUtil.java index ecd3fc3d63..c3f8e0f135 100644 --- a/src/test/java/com/google/devtools/build/lib/actions/util/ActionsTestUtil.java +++ b/src/test/java/com/google/devtools/build/lib/actions/util/ActionsTestUtil.java @@ -42,11 +42,11 @@ import com.google.devtools.build.lib.actions.Artifact.ArtifactExpander; import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact; import com.google.devtools.build.lib.actions.ArtifactOwner; import com.google.devtools.build.lib.actions.ArtifactResolver; +import com.google.devtools.build.lib.actions.ArtifactRoot; import com.google.devtools.build.lib.actions.Executor; import com.google.devtools.build.lib.actions.MutableActionGraph; import com.google.devtools.build.lib.actions.MutableActionGraph.ActionConflictException; import com.google.devtools.build.lib.actions.PackageRootResolver; -import com.google.devtools.build.lib.actions.Root; import com.google.devtools.build.lib.actions.cache.Md5Digest; import com.google.devtools.build.lib.actions.cache.Metadata; import com.google.devtools.build.lib.actions.cache.MetadataHandler; @@ -243,9 +243,10 @@ public final class ActionsTestUtil { } } - public static final Artifact DUMMY_ARTIFACT = new Artifact( - PathFragment.create("dummy"), - Root.asSourceRoot(new InMemoryFileSystem().getRootDirectory())); + public static final Artifact DUMMY_ARTIFACT = + new Artifact( + PathFragment.create("dummy"), + ArtifactRoot.asSourceRoot(new InMemoryFileSystem().getRootDirectory())); public static final ActionOwner NULL_ACTION_OWNER = ActionOwner.create( @@ -673,12 +674,12 @@ public final class ActionsTestUtil { public static class FakeArtifactResolverBase implements ArtifactResolver { @Override public Artifact getSourceArtifact( - PathFragment execPath, Root root, ArtifactOwner owner) { + PathFragment execPath, ArtifactRoot root, ArtifactOwner owner) { throw new UnsupportedOperationException(); } @Override - public Artifact getSourceArtifact(PathFragment execPath, Root root) { + public Artifact getSourceArtifact(PathFragment execPath, ArtifactRoot root) { throw new UnsupportedOperationException(); } |