aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/analysis/RunfilesTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/analysis/RunfilesTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/RunfilesTest.java106
1 files changed, 53 insertions, 53 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/RunfilesTest.java b/src/test/java/com/google/devtools/build/lib/analysis/RunfilesTest.java
index f6d1509bb1..41f543642b 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/RunfilesTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/RunfilesTest.java
@@ -50,11 +50,11 @@ public class RunfilesTest extends FoundationTestCase {
@Test
public void testFilterListForObscuringSymlinksCatchesBadObscurer() throws Exception {
Map<PathFragment, Artifact> obscuringMap = new HashMap<>();
- PathFragment pathA = new PathFragment("a");
+ PathFragment pathA = PathFragment.create("a");
Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
- Artifact artifactA = new Artifact(new PathFragment("a"), root);
+ Artifact artifactA = new Artifact(PathFragment.create("a"), root);
obscuringMap.put(pathA, artifactA);
- obscuringMap.put(new PathFragment("a/b"), new Artifact(new PathFragment("c/b"),
+ obscuringMap.put(PathFragment.create("a/b"), new Artifact(PathFragment.create("c/b"),
root));
assertThat(Runfiles.filterListForObscuringSymlinks(reporter, null, obscuringMap).entrySet())
.containsExactly(Maps.immutableEntry(pathA, artifactA)).inOrder();
@@ -64,12 +64,12 @@ public class RunfilesTest extends FoundationTestCase {
@Test
public void testFilterListForObscuringSymlinksCatchesBadGrandParentObscurer() throws Exception {
Map<PathFragment, Artifact> obscuringMap = new HashMap<>();
- PathFragment pathA = new PathFragment("a");
+ PathFragment pathA = PathFragment.create("a");
Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
- Artifact artifactA = new Artifact(new PathFragment("a"),
+ Artifact artifactA = new Artifact(PathFragment.create("a"),
root);
obscuringMap.put(pathA, artifactA);
- obscuringMap.put(new PathFragment("a/b/c"), new Artifact(new PathFragment("b/c"),
+ obscuringMap.put(PathFragment.create("a/b/c"), new Artifact(PathFragment.create("b/c"),
root));
assertThat(Runfiles.filterListForObscuringSymlinks(reporter, null, obscuringMap).entrySet())
.containsExactly(Maps.immutableEntry(pathA, artifactA)).inOrder();
@@ -79,12 +79,12 @@ public class RunfilesTest extends FoundationTestCase {
@Test
public void testFilterListForObscuringSymlinksCatchesBadObscurerNoListener() throws Exception {
Map<PathFragment, Artifact> obscuringMap = new HashMap<>();
- PathFragment pathA = new PathFragment("a");
+ PathFragment pathA = PathFragment.create("a");
Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
- Artifact artifactA = new Artifact(new PathFragment("a"),
+ Artifact artifactA = new Artifact(PathFragment.create("a"),
root);
obscuringMap.put(pathA, artifactA);
- obscuringMap.put(new PathFragment("a/b"), new Artifact(new PathFragment("c/b"),
+ obscuringMap.put(PathFragment.create("a/b"), new Artifact(PathFragment.create("c/b"),
root));
assertThat(Runfiles.filterListForObscuringSymlinks(null, null, obscuringMap).entrySet())
.containsExactly(Maps.immutableEntry(pathA, artifactA)).inOrder();
@@ -93,12 +93,12 @@ public class RunfilesTest extends FoundationTestCase {
@Test
public void testFilterListForObscuringSymlinksIgnoresOkObscurer() throws Exception {
Map<PathFragment, Artifact> obscuringMap = new HashMap<>();
- PathFragment pathA = new PathFragment("a");
+ PathFragment pathA = PathFragment.create("a");
Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
- Artifact artifactA = new Artifact(new PathFragment("a"),
+ Artifact artifactA = new Artifact(PathFragment.create("a"),
root);
obscuringMap.put(pathA, artifactA);
- obscuringMap.put(new PathFragment("a/b"), new Artifact(new PathFragment("a/b"),
+ obscuringMap.put(PathFragment.create("a/b"), new Artifact(PathFragment.create("a/b"),
root));
assertThat(Runfiles.filterListForObscuringSymlinks(reporter, null, obscuringMap).entrySet())
@@ -109,13 +109,13 @@ public class RunfilesTest extends FoundationTestCase {
@Test
public void testFilterListForObscuringSymlinksNoObscurers() throws Exception {
Map<PathFragment, Artifact> obscuringMap = new HashMap<>();
- PathFragment pathA = new PathFragment("a");
+ PathFragment pathA = PathFragment.create("a");
Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
- Artifact artifactA = new Artifact(new PathFragment("a"),
+ Artifact artifactA = new Artifact(PathFragment.create("a"),
root);
obscuringMap.put(pathA, artifactA);
- PathFragment pathBC = new PathFragment("b/c");
- Artifact artifactBC = new Artifact(new PathFragment("a/b"),
+ PathFragment pathBC = PathFragment.create("b/c");
+ Artifact artifactBC = new Artifact(PathFragment.create("a/b"),
root);
obscuringMap.put(pathBC, artifactBC);
assertThat(Runfiles.filterListForObscuringSymlinks(reporter, null, obscuringMap)
@@ -139,9 +139,9 @@ public class RunfilesTest extends FoundationTestCase {
@Test
public void testPutCatchesConflict() {
Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
- PathFragment pathA = new PathFragment("a");
- Artifact artifactB = new Artifact(new PathFragment("b"), root);
- Artifact artifactC = new Artifact(new PathFragment("c"), root);
+ PathFragment pathA = PathFragment.create("a");
+ Artifact artifactB = new Artifact(PathFragment.create("b"), root);
+ Artifact artifactC = new Artifact(PathFragment.create("c"), root);
Map<PathFragment, Artifact> map = new LinkedHashMap<>();
Runfiles.ConflictChecker checker =
@@ -156,9 +156,9 @@ public class RunfilesTest extends FoundationTestCase {
@Test
public void testPutReportsError() {
Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
- PathFragment pathA = new PathFragment("a");
- Artifact artifactB = new Artifact(new PathFragment("b"), root);
- Artifact artifactC = new Artifact(new PathFragment("c"), root);
+ PathFragment pathA = PathFragment.create("a");
+ Artifact artifactB = new Artifact(PathFragment.create("b"), root);
+ Artifact artifactC = new Artifact(PathFragment.create("c"), root);
Map<PathFragment, Artifact> map = new LinkedHashMap<>();
// Same as above but with ERROR not WARNING
@@ -174,8 +174,8 @@ public class RunfilesTest extends FoundationTestCase {
@Test
public void testPutCatchesConflictBetweenNullAndNotNull() {
Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
- PathFragment pathA = new PathFragment("a");
- Artifact artifactB = new Artifact(new PathFragment("b"), root);
+ PathFragment pathA = PathFragment.create("a");
+ Artifact artifactB = new Artifact(PathFragment.create("b"), root);
Map<PathFragment, Artifact> map = new LinkedHashMap<>();
Runfiles.ConflictChecker checker =
@@ -189,8 +189,8 @@ public class RunfilesTest extends FoundationTestCase {
@Test
public void testPutCatchesConflictBetweenNotNullAndNull() {
Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
- PathFragment pathA = new PathFragment("a");
- Artifact artifactB = new Artifact(new PathFragment("b"), root);
+ PathFragment pathA = PathFragment.create("a");
+ Artifact artifactB = new Artifact(PathFragment.create("b"), root);
Map<PathFragment, Artifact> map = new LinkedHashMap<>();
// Same as above but opposite order
@@ -205,9 +205,9 @@ public class RunfilesTest extends FoundationTestCase {
@Test
public void testPutIgnoresConflict() {
Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
- PathFragment pathA = new PathFragment("a");
- Artifact artifactB = new Artifact(new PathFragment("b"), root);
- Artifact artifactC = new Artifact(new PathFragment("c"), root);
+ PathFragment pathA = PathFragment.create("a");
+ Artifact artifactB = new Artifact(PathFragment.create("b"), root);
+ Artifact artifactC = new Artifact(PathFragment.create("c"), root);
Map<PathFragment, Artifact> map = new LinkedHashMap<>();
Runfiles.ConflictChecker checker =
@@ -221,9 +221,9 @@ public class RunfilesTest extends FoundationTestCase {
@Test
public void testPutIgnoresConflictNoListener() {
Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
- PathFragment pathA = new PathFragment("a");
- Artifact artifactB = new Artifact(new PathFragment("b"), root);
- Artifact artifactC = new Artifact(new PathFragment("c"), root);
+ PathFragment pathA = PathFragment.create("a");
+ Artifact artifactB = new Artifact(PathFragment.create("b"), root);
+ Artifact artifactC = new Artifact(PathFragment.create("c"), root);
Map<PathFragment, Artifact> map = new LinkedHashMap<>();
Runfiles.ConflictChecker checker =
@@ -237,9 +237,9 @@ public class RunfilesTest extends FoundationTestCase {
@Test
public void testPutIgnoresSameArtifact() {
Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
- PathFragment pathA = new PathFragment("a");
- Artifact artifactB = new Artifact(new PathFragment("b"), root);
- Artifact artifactB2 = new Artifact(new PathFragment("b"), root);
+ PathFragment pathA = PathFragment.create("a");
+ Artifact artifactB = new Artifact(PathFragment.create("b"), root);
+ Artifact artifactB2 = new Artifact(PathFragment.create("b"), root);
assertEquals(artifactB, artifactB2);
Map<PathFragment, Artifact> map = new LinkedHashMap<>();
@@ -253,7 +253,7 @@ public class RunfilesTest extends FoundationTestCase {
@Test
public void testPutIgnoresNullAndNull() {
- PathFragment pathA = new PathFragment("a");
+ PathFragment pathA = PathFragment.create("a");
Map<PathFragment, Artifact> map = new LinkedHashMap<>();
Runfiles.ConflictChecker checker =
@@ -268,11 +268,11 @@ public class RunfilesTest extends FoundationTestCase {
@Test
public void testPutNoConflicts() {
Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
- PathFragment pathA = new PathFragment("a");
- PathFragment pathB = new PathFragment("b");
- PathFragment pathC = new PathFragment("c");
- Artifact artifactA = new Artifact(new PathFragment("a"), root);
- Artifact artifactB = new Artifact(new PathFragment("b"), root);
+ PathFragment pathA = PathFragment.create("a");
+ PathFragment pathB = PathFragment.create("b");
+ PathFragment pathC = PathFragment.create("c");
+ Artifact artifactA = new Artifact(PathFragment.create("a"), root);
+ Artifact artifactB = new Artifact(PathFragment.create("b"), root);
Map<PathFragment, Artifact> map = new LinkedHashMap<>();
Runfiles.ConflictChecker checker =
@@ -322,8 +322,8 @@ public class RunfilesTest extends FoundationTestCase {
@Test
public void testLegacyRunfilesStructure() {
Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
- PathFragment workspaceName = new PathFragment("wsname");
- PathFragment pathB = new PathFragment("external/repo/b");
+ PathFragment workspaceName = PathFragment.create("wsname");
+ PathFragment pathB = PathFragment.create("external/repo/b");
Artifact artifactB = new Artifact(pathB, root);
Runfiles.ManifestBuilder builder = new Runfiles.ManifestBuilder(workspaceName, true);
@@ -336,15 +336,15 @@ public class RunfilesTest extends FoundationTestCase {
assertThat(builder.build().entrySet()).containsExactly(
Maps.immutableEntry(workspaceName.getRelative(pathB), artifactB),
- Maps.immutableEntry(new PathFragment("repo/b"), artifactB));
+ Maps.immutableEntry(PathFragment.create("repo/b"), artifactB));
assertNoEvents();
}
@Test
public void testRunfileAdded() {
Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
- PathFragment workspaceName = new PathFragment("wsname");
- PathFragment pathB = new PathFragment("external/repo/b");
+ PathFragment workspaceName = PathFragment.create("wsname");
+ PathFragment pathB = PathFragment.create("external/repo/b");
Artifact artifactB = new Artifact(pathB, root);
Runfiles.ManifestBuilder builder = new Runfiles.ManifestBuilder(workspaceName, false);
@@ -358,7 +358,7 @@ public class RunfilesTest extends FoundationTestCase {
assertThat(builder.build().entrySet()).containsExactly(
Maps.immutableEntry(workspaceName.getRelative(".runfile"), null),
- Maps.immutableEntry(new PathFragment("repo/b"), artifactB));
+ Maps.immutableEntry(PathFragment.create("repo/b"), artifactB));
assertNoEvents();
}
@@ -366,7 +366,7 @@ public class RunfilesTest extends FoundationTestCase {
@Test
public void testConflictWithExternal() {
Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
- PathFragment pathB = new PathFragment("repo/b");
+ PathFragment pathB = PathFragment.create("repo/b");
PathFragment externalPathB = Label.EXTERNAL_PACKAGE_NAME.getRelative(pathB);
Artifact artifactB = new Artifact(pathB, root);
Artifact artifactExternalB = new Artifact(externalPathB, root);
@@ -383,17 +383,17 @@ public class RunfilesTest extends FoundationTestCase {
builder.addUnderWorkspace(inputManifest, checker);
assertThat(builder.build().entrySet()).containsExactly(
- Maps.immutableEntry(new PathFragment("repo/b"), artifactExternalB));
+ Maps.immutableEntry(PathFragment.create("repo/b"), artifactExternalB));
checkConflictWarning();
}
@Test
public void testMergeWithSymlinks() {
Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
- Artifact artifactA = new Artifact(new PathFragment("a/target"), root);
- Artifact artifactB = new Artifact(new PathFragment("b/target"), root);
- PathFragment sympathA = new PathFragment("a/symlink");
- PathFragment sympathB = new PathFragment("b/symlink");
+ Artifact artifactA = new Artifact(PathFragment.create("a/target"), root);
+ Artifact artifactB = new Artifact(PathFragment.create("b/target"), root);
+ PathFragment sympathA = PathFragment.create("a/symlink");
+ PathFragment sympathB = PathFragment.create("b/symlink");
Runfiles runfilesA = new Runfiles.Builder("TESTING")
.addSymlink(sympathA, artifactA)
.build();