diff options
author | Philipp Wollermann <philwo@google.com> | 2015-10-22 13:12:58 +0000 |
---|---|---|
committer | Kristina Chodorow <kchodorow@google.com> | 2015-10-22 15:17:31 +0000 |
commit | d262fa501bcd6fff6de9e3fa3d71ae58a1daad27 (patch) | |
tree | 26d2a31532b81f60b9a72987d77a0d92b95d4a02 /src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java | |
parent | c708f96b4d23a1b6b03bed50013dd437ff40e92d (diff) |
ArtifactFactory.findSourceRoot now handles the case where an execPath refers to a remote repository.
--
MOS_MIGRATED_REVID=106051348
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java | 18 |
1 files changed, 18 insertions, 0 deletions
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 21a19ed290..aaf5fca146 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 @@ -53,6 +53,7 @@ public class ArtifactFactoryTest { private Path execRoot; private Root clientRoot; private Root clientRoRoot; + private Root alienRoot; private Root outRoot; private PathFragment fooPath; @@ -63,6 +64,10 @@ public class ArtifactFactoryTest { private PackageIdentifier barPackage; private PathFragment barRelative; + private PathFragment alienPath; + private PackageIdentifier alienPackage; + private PathFragment alienRelative; + private ArtifactFactory artifactFactory; @Before @@ -70,6 +75,7 @@ public class ArtifactFactoryTest { 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")); fooPath = new PathFragment("foo"); @@ -80,6 +86,10 @@ public class ArtifactFactoryTest { barPackage = PackageIdentifier.createInDefaultRepo(barPath); barRelative = barPath.getRelative("barsource.txt"); + alienPath = new PathFragment("external/alien"); + alienPackage = PackageIdentifier.create("@alien", alienPath); + alienRelative = alienPath.getRelative("alien.txt"); + artifactFactory = new ArtifactFactory(execRoot); setupRoots(); } @@ -88,6 +98,7 @@ public class ArtifactFactoryTest { Map<PackageIdentifier, Root> packageRootMap = new HashMap<>(); packageRootMap.put(fooPackage, clientRoot); packageRootMap.put(barPackage, clientRoRoot); + packageRootMap.put(alienPackage, alienRoot); artifactFactory.setPackageRoots(packageRootMap); artifactFactory.setDerivedArtifactRoots(ImmutableList.of(outRoot)); } @@ -114,6 +125,13 @@ public class ArtifactFactoryTest { } @Test + public void testResolveArtifact_inExternalRepo() throws Exception { + assertSame( + artifactFactory.getSourceArtifact(alienRelative, alienRoot), + artifactFactory.resolveSourceArtifact(alienRelative)); + } + + @Test public void testResolveArtifact_noDerived_derivedRoot() throws Exception { assertNull(artifactFactory.resolveSourceArtifact( outRoot.getPath().getRelative(fooRelative).relativeTo(execRoot))); |