use of com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem in project bazel by bazelbuild.
the class IncrementalLoadingTest method createTester.
@Before
public final void createTester() throws Exception {
ManualClock clock = new ManualClock();
FileSystem fs = new InMemoryFileSystem(clock) {
@Override
public Collection<Dirent> readdir(Path path, boolean followSymlinks) throws IOException {
if (path.equals(throwOnReaddir)) {
throw new FileNotFoundException(path.getPathString());
}
return super.readdir(path, followSymlinks);
}
@Nullable
@Override
public FileStatus stat(Path path, boolean followSymlinks) throws IOException {
if (path.equals(throwOnStat)) {
throw new IOException("bork " + path.getPathString());
}
return super.stat(path, followSymlinks);
}
};
tester = createTester(fs, clock);
}
use of com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem in project bazel by bazelbuild.
the class PackageFactoryTestBase method initializeFileSystem.
@Before
public final void initializeFileSystem() throws Exception {
FileSystem fs = new InMemoryFileSystem() {
@Override
public Collection<Dirent> readdir(Path path, boolean followSymlinks) throws IOException {
if (path.equals(throwOnReaddir)) {
throw new FileNotFoundException(path.getPathString());
}
return super.readdir(path, followSymlinks);
}
};
Path tmpPath = fs.getPath("/tmp");
scratch = new Scratch(tmpPath);
}
use of com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem in project bazel by bazelbuild.
the class FileSymlinkCycleUniquenessFunctionTest method testHashCodeAndEqualsContract.
@Test
public void testHashCodeAndEqualsContract() throws Exception {
Path root = new InMemoryFileSystem().getRootDirectory().getRelative("root");
RootedPath p1 = RootedPath.toRootedPath(root, new PathFragment("p1"));
RootedPath p2 = RootedPath.toRootedPath(root, new PathFragment("p2"));
RootedPath p3 = RootedPath.toRootedPath(root, new PathFragment("p3"));
ImmutableList<RootedPath> cycleA1 = ImmutableList.of(p1);
ImmutableList<RootedPath> cycleB1 = ImmutableList.of(p2);
ImmutableList<RootedPath> cycleC1 = ImmutableList.of(p1, p2, p3);
ImmutableList<RootedPath> cycleC2 = ImmutableList.of(p2, p3, p1);
ImmutableList<RootedPath> cycleC3 = ImmutableList.of(p3, p1, p2);
new EqualsTester().addEqualityGroup(FileSymlinkCycleUniquenessFunction.key(cycleA1)).addEqualityGroup(FileSymlinkCycleUniquenessFunction.key(cycleB1)).addEqualityGroup(FileSymlinkCycleUniquenessFunction.key(cycleC1), FileSymlinkCycleUniquenessFunction.key(cycleC2), FileSymlinkCycleUniquenessFunction.key(cycleC3)).testEquals();
}
use of com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem in project bazel by bazelbuild.
the class MapBasedActionGraphTest method testSmoke.
@Test
public void testSmoke() throws Exception {
MutableActionGraph actionGraph = new MapBasedActionGraph();
FileSystem fileSystem = new InMemoryFileSystem(BlazeClock.instance());
Path path = fileSystem.getPath("/root/foo");
Artifact output = new Artifact(path, Root.asDerivedRoot(path));
Action action = new TestAction(TestAction.NO_EFFECT, ImmutableSet.<Artifact>of(), ImmutableSet.of(output));
actionGraph.registerAction(action);
actionGraph.unregisterAction(action);
path = fileSystem.getPath("/root/bar");
output = new Artifact(path, Root.asDerivedRoot(path));
Action action2 = new TestAction(TestAction.NO_EFFECT, ImmutableSet.<Artifact>of(), ImmutableSet.of(output));
actionGraph.registerAction(action);
actionGraph.registerAction(action2);
actionGraph.unregisterAction(action);
}
use of com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem in project bazel by bazelbuild.
the class MapBasedActionGraphTest method testNoActionConflictWhenUnregisteringSharedAction.
@Test
public void testNoActionConflictWhenUnregisteringSharedAction() throws Exception {
MutableActionGraph actionGraph = new MapBasedActionGraph();
FileSystem fileSystem = new InMemoryFileSystem(BlazeClock.instance());
Path path = fileSystem.getPath("/root/foo");
Artifact output = new Artifact(path, Root.asDerivedRoot(path));
Action action = new TestAction(TestAction.NO_EFFECT, ImmutableSet.<Artifact>of(), ImmutableSet.of(output));
actionGraph.registerAction(action);
Action otherAction = new TestAction(TestAction.NO_EFFECT, ImmutableSet.<Artifact>of(), ImmutableSet.of(output));
actionGraph.registerAction(otherAction);
actionGraph.unregisterAction(action);
}
Aggregations