Search in sources :

Example 11 with Scratch

use of com.google.devtools.build.lib.testutil.Scratch in project bazel by bazelbuild.

the class RepositoryCacheTest method setUp.

@Before
public void setUp() throws Exception {
    scratch = new Scratch("/");
    repositoryCachePath = scratch.dir("/repository_cache");
    repositoryCache = new RepositoryCache();
    repositoryCache.setRepositoryCachePath(repositoryCachePath);
    contentAddressableCachePath = repositoryCache.getContentAddressableCachePath();
    downloadedFile = scratch.file("file.tmp", Charset.defaultCharset(), "contents");
    downloadedFileSha256 = "bfe5ed57e6e323555b379c660aa8d35b70c2f8f07cf03ad6747266495ac13be0";
}
Also used : Scratch(com.google.devtools.build.lib.testutil.Scratch) Before(org.junit.Before)

Example 12 with Scratch

use of com.google.devtools.build.lib.testutil.Scratch 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);
}
Also used : Path(com.google.devtools.build.lib.vfs.Path) Scratch(com.google.devtools.build.lib.testutil.Scratch) 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) Dirent(com.google.devtools.build.lib.vfs.Dirent) FileNotFoundException(java.io.FileNotFoundException) Before(org.junit.Before)

Example 13 with Scratch

use of com.google.devtools.build.lib.testutil.Scratch in project bazel by bazelbuild.

the class TopLevelArtifactHelperTest method setRootDir.

@Before
public final void setRootDir() throws Exception {
    Scratch scratch = new Scratch();
    path = scratch.dir("/foo");
    root = Root.asDerivedRoot(scratch.dir("/"));
}
Also used : Scratch(com.google.devtools.build.lib.testutil.Scratch) Before(org.junit.Before)

Example 14 with Scratch

use of com.google.devtools.build.lib.testutil.Scratch in project bazel by bazelbuild.

the class ScratchAttributeWriter method write.

/**
   * Writes this scratch target to this ScratchAttributeWriter's Scratch instance, and returns the
   * target in the given configuration.
   */
public ConfiguredTarget write(BuildConfiguration config) throws Exception {
    Scratch scratch = testCase.getScratch();
    buildString.append(")");
    scratch.file(String.format("%s/BUILD", packageName), buildString.toString());
    return testCase.getConfiguredTarget(String.format("//%s:%s", packageName, targetName), config);
}
Also used : Scratch(com.google.devtools.build.lib.testutil.Scratch)

Example 15 with Scratch

use of com.google.devtools.build.lib.testutil.Scratch in project bazel by bazelbuild.

the class GrpcActionCacheTest method setUp.

@Before
public final void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    scratch = new Scratch();
    rootDir = Root.asDerivedRoot(scratch.dir("/exec/root"));
    server.start();
}
Also used : Scratch(com.google.devtools.build.lib.testutil.Scratch) Before(org.junit.Before)

Aggregations

Scratch (com.google.devtools.build.lib.testutil.Scratch)15 Before (org.junit.Before)13 Path (com.google.devtools.build.lib.vfs.Path)4 SpecialArtifact (com.google.devtools.build.lib.actions.Artifact.SpecialArtifact)1 TreeFileArtifact (com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact)1 BlazeDirectories (com.google.devtools.build.lib.analysis.BlazeDirectories)1 ConfigurationCollectionFactory (com.google.devtools.build.lib.analysis.ConfigurationCollectionFactory)1 ServerDirectories (com.google.devtools.build.lib.analysis.ServerDirectories)1 BuildConfiguration (com.google.devtools.build.lib.analysis.config.BuildConfiguration)1 Dirent (com.google.devtools.build.lib.vfs.Dirent)1 FileSystem (com.google.devtools.build.lib.vfs.FileSystem)1 InMemoryFileSystem (com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem)1 FileNotFoundException (java.io.FileNotFoundException)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1