aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/skyframe
diff options
context:
space:
mode:
authorGravatar tomlu <tomlu@google.com>2018-01-18 10:29:11 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-01-18 10:31:11 -0800
commit4c9fafd8e7137ed117529e0a72ed4d9aefe6ec48 (patch)
tree323f9f1ba9aba622847f2da082f273b9c8e09ebf /src/test/java/com/google/devtools/build/lib/skyframe
parent4dce09cdc7914d76401a6f77fd78e0176d173dd1 (diff)
Add absolute root concept.
An absolute root accepts any absolute path fragments and simply returns it. This concept replaces the FileSystem root directory concept. PiperOrigin-RevId: 182400471
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skyframe')
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/FileFunctionTest.java26
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java13
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/GlobDescriptorTest.java3
3 files changed, 21 insertions, 21 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/FileFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/FileFunctionTest.java
index d0e33b537b..c472b26896 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/FileFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/FileFunctionTest.java
@@ -186,7 +186,7 @@ public class FileFunctionTest {
}
private FileValue valueForPathOutsidePkgRoot(Path path) throws InterruptedException {
- return valueForPathHelper(Root.fromFileSystemRoot(fs), path);
+ return valueForPathHelper(Root.absoluteRoot(fs), path);
}
private FileValue valueForPathHelper(Root root, Path path) throws InterruptedException {
@@ -315,8 +315,8 @@ public class FileFunctionTest {
.containsExactly(
rootedPath("a"),
rootedPath(""),
- RootedPath.toRootedPath(Root.fromFileSystemRoot(fs), PathFragment.EMPTY_FRAGMENT),
- RootedPath.toRootedPath(Root.fromFileSystemRoot(fs), PathFragment.create("outside")));
+ RootedPath.toRootedPath(Root.absoluteRoot(fs), PathFragment.create("/")),
+ RootedPath.toRootedPath(Root.absoluteRoot(fs), PathFragment.create("/outside")));
}
@Test
@@ -332,8 +332,8 @@ public class FileFunctionTest {
.containsExactly(
rootedPath("a"),
rootedPath(""),
- RootedPath.toRootedPath(Root.fromFileSystemRoot(fs), PathFragment.EMPTY_FRAGMENT),
- RootedPath.toRootedPath(Root.fromFileSystemRoot(fs), PathFragment.create("absolute")));
+ RootedPath.toRootedPath(Root.absoluteRoot(fs), PathFragment.create("/")),
+ RootedPath.toRootedPath(Root.absoluteRoot(fs), PathFragment.create("/absolute")));
}
@Test
@@ -347,17 +347,17 @@ public class FileFunctionTest {
seenFiles.addAll(getFilesSeenAndAssertValueChangesIfContentsOfFileChanges("b", false, "a"));
seenFiles.addAll(
getFilesSeenAndAssertValueChangesIfContentsOfFileChanges(externalPath, true, "a"));
- Root root = Root.fromFileSystemRoot(fs);
+ Root root = Root.absoluteRoot(fs);
assertThat(seenFiles)
.containsExactly(
rootedPath("WORKSPACE"),
rootedPath("a"),
rootedPath(""),
- RootedPath.toRootedPath(root, PathFragment.EMPTY_FRAGMENT),
- RootedPath.toRootedPath(root, PathFragment.create("output_base")),
- RootedPath.toRootedPath(root, PathFragment.create("output_base/external")),
- RootedPath.toRootedPath(root, PathFragment.create("output_base/external/a")),
- RootedPath.toRootedPath(root, PathFragment.create("output_base/external/a/b")));
+ RootedPath.toRootedPath(root, PathFragment.create("/")),
+ RootedPath.toRootedPath(root, PathFragment.create("/output_base")),
+ RootedPath.toRootedPath(root, PathFragment.create("/output_base/external")),
+ RootedPath.toRootedPath(root, PathFragment.create("/output_base/external/a")),
+ RootedPath.toRootedPath(root, PathFragment.create("/output_base/external/a/b")));
}
@Test
@@ -1111,7 +1111,7 @@ public class FileFunctionTest {
// InMemoryFS is not supported for serialization.
FileSystem fs = FileSystems.getJavaIoFileSystem();
Path.setFileSystemForSerialization(fs);
- pkgRoot = Root.fromFileSystemRoot(fs);
+ pkgRoot = Root.absoluteRoot(fs);
FileValue a = valueForPath(fs.getPath("/"));
@@ -1654,7 +1654,7 @@ public class FileFunctionTest {
return RootedPath.toRootedPath(root, path);
}
}
- return RootedPath.toRootedPath(Root.fromFileSystemRoot(fs), path);
+ return RootedPath.toRootedPath(Root.absoluteRoot(fs), path);
}
private SkyKey skyKey(String pathString) {
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java
index 851b7a8351..8b421f65f0 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java
@@ -160,7 +160,7 @@ public class FilesystemValueCheckerTest {
SkyKey skyKey =
FileStateValue.key(
- RootedPath.toRootedPath(Root.fromFileSystemRoot(fs), PathFragment.create("foo")));
+ RootedPath.toRootedPath(Root.absoluteRoot(fs), PathFragment.create("/foo")));
EvaluationResult<SkyValue> result =
driver.evaluate(
ImmutableList.of(skyKey),
@@ -211,14 +211,13 @@ public class FilesystemValueCheckerTest {
FileSystemUtils.ensureSymbolicLink(sym1, path);
FileSystemUtils.ensureSymbolicLink(sym2, path);
SkyKey fooKey =
- FileValue.key(
- RootedPath.toRootedPath(Root.fromFileSystemRoot(fs), PathFragment.create("foo")));
+ FileValue.key(RootedPath.toRootedPath(Root.absoluteRoot(fs), PathFragment.create("/foo")));
RootedPath symlinkRootedPath =
- RootedPath.toRootedPath(Root.fromFileSystemRoot(fs), PathFragment.create("bar"));
+ RootedPath.toRootedPath(Root.absoluteRoot(fs), PathFragment.create("/bar"));
SkyKey symlinkKey = FileValue.key(symlinkRootedPath);
SkyKey symlinkFileStateKey = FileStateValue.key(symlinkRootedPath);
RootedPath sym1RootedPath =
- RootedPath.toRootedPath(Root.fromFileSystemRoot(fs), PathFragment.create("sym1"));
+ RootedPath.toRootedPath(Root.absoluteRoot(fs), PathFragment.create("/sym1"));
SkyKey sym1FileStateKey = FileStateValue.key(sym1RootedPath);
Iterable<SkyKey> allKeys = ImmutableList.of(symlinkKey, fooKey);
@@ -280,10 +279,10 @@ public class FilesystemValueCheckerTest {
SkyKey key1 =
FileStateValue.key(
- RootedPath.toRootedPath(Root.fromFileSystemRoot(fs), PathFragment.create("foo1")));
+ RootedPath.toRootedPath(Root.absoluteRoot(fs), PathFragment.create("/foo1")));
SkyKey key2 =
FileStateValue.key(
- RootedPath.toRootedPath(Root.fromFileSystemRoot(fs), PathFragment.create("foo2")));
+ RootedPath.toRootedPath(Root.absoluteRoot(fs), PathFragment.create("/foo2")));
Iterable<SkyKey> skyKeys = ImmutableList.of(key1, key2);
EvaluationResult<SkyValue> result =
driver.evaluate(
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/GlobDescriptorTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/GlobDescriptorTest.java
index e9605e328a..c3daa37846 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/GlobDescriptorTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/GlobDescriptorTest.java
@@ -33,7 +33,8 @@ public class GlobDescriptorTest {
@Test
public void testSerialization() throws Exception {
ObjectCodecTester.newBuilder(
- GlobDescriptor.getCodec(Root.getCodec(new PathCodec(FsUtils.TEST_FILESYSTEM))))
+ GlobDescriptor.getCodec(
+ Root.getCodec(FsUtils.TEST_FILESYSTEM, new PathCodec(FsUtils.TEST_FILESYSTEM))))
.addSubjects(
GlobDescriptor.create(
PackageIdentifier.create("@foo", PathFragment.create("//bar")),