aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build
diff options
context:
space:
mode:
authorGravatar Kristina Chodorow <kchodorow@google.com>2016-08-25 14:17:30 +0000
committerGravatar John Cater <jcater@google.com>2016-08-25 20:19:17 +0000
commit94e2742db235c7bf7d254a8d5a4c10ff3495c656 (patch)
tree73b820e3c97457f3836d63396b943b707e8f4b4b /src/test/java/com/google/devtools/build
parente001d731814255d9e41561442339f3feec590bc2 (diff)
Remove ArtifactFactory dependency on incorrect exec root
Somewhat trickily, this changes the execRoot field from referring to [output_base]/execroot/wsname (not really the exec root) to [output_base]/execroot (actually the execroot). Progress on #1681. -- MOS_MIGRATED_REVID=131286181
Diffstat (limited to 'src/test/java/com/google/devtools/build')
-rw-r--r--src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java14
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java2
2 files changed, 7 insertions, 9 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 f9c31ca044..cfdeef4797 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
@@ -92,7 +92,7 @@ public class ArtifactFactoryTest {
alienPackage = PackageIdentifier.create("@alien", alienPath);
alienRelative = alienPath.getRelative("alien.txt");
- artifactFactory = new ArtifactFactory(execRoot);
+ artifactFactory = new ArtifactFactory(execRoot, "bazel-out");
setupRoots();
}
@@ -102,7 +102,6 @@ public class ArtifactFactoryTest {
packageRootMap.put(barPackage, clientRoRoot);
packageRootMap.put(alienPackage, alienRoot);
artifactFactory.setPackageRoots(packageRootMap);
- artifactFactory.setDerivedArtifactRoots(ImmutableList.of(outRoot));
}
@Test
@@ -182,10 +181,9 @@ public class ArtifactFactoryTest {
@Test
public void testFindDerivedRoot() throws Exception {
- assertSame(outRoot,
- artifactFactory.findDerivedRoot(outRoot.getPath().getRelative(fooRelative)));
- assertSame(outRoot,
- artifactFactory.findDerivedRoot(outRoot.getPath().getRelative(barRelative)));
+ assertThat(artifactFactory.isDerivedArtifact(fooRelative)).isFalse();
+ assertThat(artifactFactory.isDerivedArtifact(
+ new PathFragment("bazel-out/local-fastbuild/bin/foo"))).isTrue();
}
@Test
@@ -210,7 +208,7 @@ public class ArtifactFactoryTest {
@Test
public void testGetDerivedArtifact() throws Exception {
PathFragment toolPath = new PathFragment("_bin/tool");
- Artifact artifact = artifactFactory.getDerivedArtifact(toolPath);
+ Artifact artifact = artifactFactory.getDerivedArtifact(toolPath, execRoot);
assertEquals(toolPath, artifact.getExecPath());
assertEquals(Root.asDerivedRoot(execRoot), artifact.getRoot());
assertEquals(execRoot.getRelative(toolPath), artifact.getPath());
@@ -220,7 +218,7 @@ public class ArtifactFactoryTest {
@Test
public void testGetDerivedArtifactFailsForAbsolutePath() throws Exception {
try {
- artifactFactory.getDerivedArtifact(new PathFragment("/_bin/b"));
+ artifactFactory.getDerivedArtifact(new PathFragment("/_bin/b"), execRoot);
fail();
} catch (IllegalArgumentException e) {
// Expected exception
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java
index f5fda5c2f1..9f4514cd94 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java
@@ -424,7 +424,7 @@ public abstract class BuildViewTestCase extends FoundationTestCase {
view.setConfigurationsForTesting(masterConfig);
view.setArtifactRoots(
- ImmutableMap.of(PackageIdentifier.createInMainRepo(""), rootDirectory), masterConfig);
+ ImmutableMap.of(PackageIdentifier.createInMainRepo(""), rootDirectory));
simulateLoadingPhase();
}