Search in sources :

Example 6 with Scratch

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

the class TreeNodeRepositoryTest method setRootDir.

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

Example 7 with Scratch

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

the class JarDecompressorTest method setUpFs.

@Before
public void setUpFs() throws Exception {
    Scratch fs = new Scratch();
    Path dir = fs.dir("/whatever/external/tester");
    Path jar = fs.file("/foo.jar", "I'm a jar");
    FileSystemUtils.createDirectoryAndParents(dir);
    descriptorBuilder = DecompressorDescriptor.builder().setDecompressor(JarDecompressor.INSTANCE).setTargetName("tester").setTargetKind("http_jar rule").setRepositoryPath(dir).setArchivePath(jar);
}
Also used : Path(com.google.devtools.build.lib.vfs.Path) Scratch(com.google.devtools.build.lib.testutil.Scratch) Before(org.junit.Before)

Example 8 with Scratch

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

the class CommandInterruptionTest method setUp.

@Before
public void setUp() throws Exception {
    executor = Executors.newSingleThreadExecutor();
    Scratch scratch = new Scratch();
    isTestShuttingDown = new AtomicBoolean(false);
    String productName = TestConstants.PRODUCT_NAME;
    ServerDirectories serverDirectories = new ServerDirectories(scratch.dir("install"), scratch.dir("output"));
    BlazeRuntime runtime = new BlazeRuntime.Builder().setProductName(productName).setServerDirectories(serverDirectories).setStartupOptionsProvider(OptionsParser.newOptionsParser(BlazeServerStartupOptions.class)).addBlazeModule(new BlazeModule() {

        @Override
        public void initializeRuleClasses(ConfiguredRuleClassProvider.Builder builder) {
            // Can't create a Skylark environment without a tools repository!
            builder.setToolsRepository(TestConstants.TOOLS_REPOSITORY);
            // Can't create a runtime without a configuration collection factory!
            builder.setConfigurationCollectionFactory(Mockito.mock(ConfigurationCollectionFactory.class));
            // Can't create a defaults package without the base options in there!
            builder.addConfigurationOptions(BuildConfiguration.Options.class);
        }
    }).build();
    snooze = new WaitForCompletionCommand(isTestShuttingDown);
    dispatcher = new BlazeCommandDispatcher(runtime, snooze);
    BlazeDirectories blazeDirectories = new BlazeDirectories(serverDirectories, scratch.dir("workspace"), productName);
    runtime.initWorkspace(blazeDirectories, /*bintools=*/
    null);
}
Also used : ServerDirectories(com.google.devtools.build.lib.analysis.ServerDirectories) BuildConfiguration(com.google.devtools.build.lib.analysis.config.BuildConfiguration) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) BlazeDirectories(com.google.devtools.build.lib.analysis.BlazeDirectories) Scratch(com.google.devtools.build.lib.testutil.Scratch) ConfigurationCollectionFactory(com.google.devtools.build.lib.analysis.ConfigurationCollectionFactory) Before(org.junit.Before)

Example 9 with Scratch

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

the class CompositeRunfilesSupplierTest method createMocks.

@Before
public final void createMocks() throws IOException {
    Scratch scratch = new Scratch();
    rootDir = Root.asDerivedRoot(scratch.dir("/fake/root/dont/matter"));
    mockFirst = mock(RunfilesSupplier.class);
    mockSecond = mock(RunfilesSupplier.class);
}
Also used : Scratch(com.google.devtools.build.lib.testutil.Scratch) Before(org.junit.Before)

Example 10 with Scratch

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

the class ArtifactTest method setRootDir.

@Before
public final void setRootDir() throws Exception {
    scratch = new Scratch();
    execDir = scratch.dir("/exec");
    rootDir = Root.asDerivedRoot(scratch.dir("/exec/root"));
}
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