Search in sources :

Example 21 with InMemoryFileSystem

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

the class TestSummaryTest method createFileSystem.

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

Example 22 with InMemoryFileSystem

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

the class PathWindowsTest method initializeFileSystem.

@Before
public final void initializeFileSystem() throws Exception {
    filesystem = new InMemoryFileSystem(BlazeClock.instance()) {

        @Override
        protected PathFactory getPathFactory() {
            return WindowsFileSystem.getPathFactoryForTesting(shortPathResolver);
        }

        @Override
        public boolean isFilePathCaseSensitive() {
            return false;
        }
    };
    root = (WindowsPath) filesystem.getRootDirectory().getRelative("C:/");
    root.createDirectory();
}
Also used : InMemoryFileSystem(com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem) PathFactory(com.google.devtools.build.lib.vfs.Path.PathFactory) Before(org.junit.Before)

Example 23 with InMemoryFileSystem

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

the class PathTest method initializeFileSystem.

@Before
public final void initializeFileSystem() throws Exception {
    filesystem = new InMemoryFileSystem(BlazeClock.instance());
    root = filesystem.getRootDirectory();
    Path first = root.getChild("first");
    first.createDirectory();
}
Also used : InMemoryFileSystem(com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem) Before(org.junit.Before)

Example 24 with InMemoryFileSystem

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

the class RecursiveGlobTest method initializeFileSystem.

@Before
public final void initializeFileSystem() throws Exception {
    fileSystem = new InMemoryFileSystem(BlazeClock.instance());
    tmpPath = fileSystem.getPath("/rglobtmp");
    for (String dir : ImmutableList.of("foo/bar/wiz", "foo/baz/wiz", "foo/baz/quip/wiz", "food/baz/wiz", "fool/baz/wiz")) {
        FileSystemUtils.createDirectoryAndParents(tmpPath.getRelative(dir));
    }
    FileSystemUtils.createEmptyFile(tmpPath.getRelative("foo/bar/wiz/file"));
}
Also used : InMemoryFileSystem(com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem) Before(org.junit.Before)

Example 25 with InMemoryFileSystem

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

the class GlobTest method initializeFileSystem.

@Before
public final void initializeFileSystem() throws Exception {
    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);
        }
    };
    tmpPath = fs.getPath("/globtmp");
    for (String dir : ImmutableList.of("foo/bar/wiz", "foo/barnacle/wiz", "food/barnacle/wiz", "fool/barnacle/wiz")) {
        FileSystemUtils.createDirectoryAndParents(tmpPath.getRelative(dir));
    }
    FileSystemUtils.createEmptyFile(tmpPath.getRelative("foo/bar/wiz/file"));
}
Also used : InMemoryFileSystem(com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem) FileNotFoundException(java.io.FileNotFoundException) Collection(java.util.Collection) IOException(java.io.IOException) Before(org.junit.Before)

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