Search in sources :

Example 1 with Scratch

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

the class CustomCommandLineTest method createArtifacts.

@Before
public void createArtifacts() throws Exception {
    scratch = new Scratch();
    rootDir = Root.asDerivedRoot(scratch.dir("/exec/root"));
    artifact1 = new Artifact(scratch.file("/exec/root/dir/file1.txt"), rootDir);
    artifact2 = new Artifact(scratch.file("/exec/root/dir/file2.txt"), rootDir);
}
Also used : Scratch(com.google.devtools.build.lib.testutil.Scratch) SpecialArtifact(com.google.devtools.build.lib.actions.Artifact.SpecialArtifact) TreeFileArtifact(com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact) Before(org.junit.Before)

Example 2 with Scratch

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

the class SpawnActionTemplateTest method setRootDir.

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

Example 3 with Scratch

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

the class RunfilesSupplierImplTest method setRoot.

@Before
public final void setRoot() throws IOException {
    Scratch scratch = new Scratch();
    rootDir = Root.asDerivedRoot(scratch.dir("/fake/root/dont/matter"));
    Path middlemanExecPath = scratch.dir("/still/fake/root/dont/matter");
    middlemanRoot = Root.middlemanRoot(middlemanExecPath, middlemanExecPath.getChild("subdir"));
}
Also used : Path(com.google.devtools.build.lib.vfs.Path) Scratch(com.google.devtools.build.lib.testutil.Scratch) Before(org.junit.Before)

Example 4 with Scratch

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

the class SkylarkRepositoryContextTest method setUp.

@Before
public void setUp() throws Exception {
    scratch = new Scratch("/");
    outputDirectory = scratch.dir("/outputDir");
    workspaceFile = scratch.file("/WORKSPACE");
}
Also used : Scratch(com.google.devtools.build.lib.testutil.Scratch) Before(org.junit.Before)

Example 5 with Scratch

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

the class ProfilerChartTest method createProfileInfo.

private ProfileInfo createProfileInfo(Runnable runnable, int noOfRows) throws Exception {
    Scratch scratch = new Scratch();
    Path cacheDir = scratch.dir("/tmp");
    Path cacheFile = cacheDir.getRelative("profile1.dat");
    Profiler profiler = Profiler.instance();
    profiler.start(ProfiledTaskKinds.ALL, cacheFile.getOutputStream(), "basic test", false, BlazeClock.instance(), BlazeClock.instance().nanoTime());
    // Write from multiple threads to generate multiple rows in the chart.
    for (int i = 0; i < noOfRows; i++) {
        Thread t = new Thread(runnable);
        t.start();
        t.join();
    }
    profiler.stop();
    return ProfileInfo.loadProfile(cacheFile);
}
Also used : Path(com.google.devtools.build.lib.vfs.Path) Scratch(com.google.devtools.build.lib.testutil.Scratch)

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