Search in sources :

Example 6 with InMemoryFileSystem

use of com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem in project bazel by bazelbuild.

the class SpawnInputExpanderTest method createSpawnInputExpander.

@Before
public final void createSpawnInputExpander() throws Exception {
    fs = new InMemoryFileSystem();
    expander = new SpawnInputExpander(/*strict=*/
    true);
    inputMappings = Maps.newHashMap();
}
Also used : InMemoryFileSystem(com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem) Before(org.junit.Before)

Example 7 with InMemoryFileSystem

use of com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem in project bazel by bazelbuild.

the class DiffAwarenessManagerTest method createFileSystem.

@Before
public final void createFileSystem() throws Exception {
    fs = new InMemoryFileSystem();
    root = fs.getRootDirectory();
}
Also used : InMemoryFileSystem(com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem) Before(org.junit.Before)

Example 8 with InMemoryFileSystem

use of com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem in project bazel by bazelbuild.

the class FsApparatus method createUnixTempDir.

/**
   * Create a fresh directory in the system temporary directory, instead of the
   * testing directory provided by the testing framework. This path is usually
   * shorter than a path starting with TestUtil.getTmpDir(). We care about the
   * length because of the path length restriction for Unix local socket files.
   *
   * Clients are responsible for deleting the directory after tests.
   */
public Path createUnixTempDir() throws IOException {
    if (fileSystem instanceof InMemoryFileSystem) {
        throw new IOException("Can not create Unix temporary directories in " + "an in-memory file system");
    }
    File file = File.createTempFile("scratch", "tmp");
    final Path path = fileSystem.getPath(file.getAbsolutePath());
    path.delete();
    path.createDirectory();
    return path;
}
Also used : Path(com.google.devtools.build.lib.vfs.Path) InMemoryFileSystem(com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem) IOException(java.io.IOException) File(java.io.File)

Example 9 with InMemoryFileSystem

use of com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem in project bazel by bazelbuild.

the class FileSystemUtilsTest method initializeFileSystem.

@Before
public final void initializeFileSystem() throws Exception {
    clock = new ManualClock();
    fileSystem = new InMemoryFileSystem(clock);
    workingDir = fileSystem.getPath("/workingDir");
    workingDir.createDirectory();
}
Also used : ManualClock(com.google.devtools.build.lib.testutil.ManualClock) InMemoryFileSystem(com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem) Before(org.junit.Before)

Example 10 with InMemoryFileSystem

use of com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem in project bazel by bazelbuild.

the class FileTypeTest method handlesPathObjects.

@Test
public void handlesPathObjects() {
    Path readme = new InMemoryFileSystem().getPath("/readme.txt");
    assertTrue(TEXT.matches(readme));
}
Also used : Path(com.google.devtools.build.lib.vfs.Path) InMemoryFileSystem(com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem) Test(org.junit.Test)

Aggregations

InMemoryFileSystem (com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem)26 Path (com.google.devtools.build.lib.vfs.Path)14 Before (org.junit.Before)14 FileSystem (com.google.devtools.build.lib.vfs.FileSystem)8 Test (org.junit.Test)8 IOException (java.io.IOException)7 TestAction (com.google.devtools.build.lib.actions.util.TestAction)3 ManualClock (com.google.devtools.build.lib.testutil.ManualClock)3 HashFunction (com.google.devtools.build.lib.vfs.FileSystem.HashFunction)3 FileNotFoundException (java.io.FileNotFoundException)3 EqualsTester (com.google.common.testing.EqualsTester)2 Dirent (com.google.devtools.build.lib.vfs.Dirent)2 PathFragment (com.google.devtools.build.lib.vfs.PathFragment)2 File (java.io.File)2 Artifact (com.google.devtools.build.lib.actions.Artifact)1 BuildFailedException (com.google.devtools.build.lib.actions.BuildFailedException)1 BlazeDirectories (com.google.devtools.build.lib.analysis.BlazeDirectories)1 Scratch (com.google.devtools.build.lib.testutil.Scratch)1 TestThread (com.google.devtools.build.lib.testutil.TestThread)1 FileStatus (com.google.devtools.build.lib.vfs.FileStatus)1