Search in sources :

Example 16 with FileSystem

use of com.google.devtools.build.lib.vfs.FileSystem 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);
}
Also used : Path(com.google.devtools.build.lib.vfs.Path) TestAction(com.google.devtools.build.lib.actions.util.TestAction) InMemoryFileSystem(com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem) FileSystem(com.google.devtools.build.lib.vfs.FileSystem) InMemoryFileSystem(com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem) TestAction(com.google.devtools.build.lib.actions.util.TestAction) Test(org.junit.Test)

Example 17 with FileSystem

use of com.google.devtools.build.lib.vfs.FileSystem 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);
}
Also used : Path(com.google.devtools.build.lib.vfs.Path) TestAction(com.google.devtools.build.lib.actions.util.TestAction) InMemoryFileSystem(com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem) FileSystem(com.google.devtools.build.lib.vfs.FileSystem) InMemoryFileSystem(com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem) TestAction(com.google.devtools.build.lib.actions.util.TestAction) Test(org.junit.Test)

Aggregations

FileSystem (com.google.devtools.build.lib.vfs.FileSystem)17 Path (com.google.devtools.build.lib.vfs.Path)17 InMemoryFileSystem (com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem)11 IOException (java.io.IOException)7 Test (org.junit.Test)6 PathFragment (com.google.devtools.build.lib.vfs.PathFragment)4 RootedPath (com.google.devtools.build.lib.vfs.RootedPath)4 TestAction (com.google.devtools.build.lib.actions.util.TestAction)3 HashFunction (com.google.devtools.build.lib.vfs.FileSystem.HashFunction)3 DirectoryListingValue (com.google.devtools.build.lib.skyframe.DirectoryListingValue)2 Dirent (com.google.devtools.build.lib.vfs.Dirent)2 FileNotFoundException (java.io.FileNotFoundException)2 Before (org.junit.Before)2 Predicate (com.google.common.base.Predicate)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Artifact (com.google.devtools.build.lib.actions.Artifact)1 SpecialArtifact (com.google.devtools.build.lib.actions.Artifact.SpecialArtifact)1 BuildFailedException (com.google.devtools.build.lib.actions.BuildFailedException)1 BlazeDirectories (com.google.devtools.build.lib.analysis.BlazeDirectories)1 ServerDirectories (com.google.devtools.build.lib.analysis.ServerDirectories)1