Search in sources :

Example 21 with ManualClock

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

the class IncrementalLoadingTest method createTester.

@Before
public final void createTester() throws Exception {
    ManualClock clock = new ManualClock();
    FileSystem fs = new InMemoryFileSystem(clock) {

        @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);
        }

        @Nullable
        @Override
        public FileStatus stat(Path path, boolean followSymlinks) throws IOException {
            if (path.equals(throwOnStat)) {
                throw new IOException("bork " + path.getPathString());
            }
            return super.stat(path, followSymlinks);
        }
    };
    tester = createTester(fs, clock);
}
Also used : Path(com.google.devtools.build.lib.vfs.Path) ManualClock(com.google.devtools.build.lib.testutil.ManualClock) FileSystem(com.google.devtools.build.lib.vfs.FileSystem) InMemoryFileSystem(com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem) InMemoryFileSystem(com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem) Dirent(com.google.devtools.build.lib.vfs.Dirent) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) Before(org.junit.Before)

Example 22 with ManualClock

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

the class GlobFunctionTest method setUp.

@Before
public final void setUp() throws Exception {
    fs = new CustomInMemoryFs(new ManualClock());
    root = fs.getRootDirectory().getRelative("root/workspace");
    writableRoot = fs.getRootDirectory().getRelative("writableRoot/workspace");
    outputBase = fs.getRootDirectory().getRelative("output_base");
    pkgPath = root.getRelative(PKG_ID.getPackageFragment());
    pkgLocator = new AtomicReference<>(new PathPackageLocator(outputBase, ImmutableList.of(writableRoot, root)));
    differencer = new RecordingDifferencer();
    evaluator = new InMemoryMemoizingEvaluator(createFunctionMap(), differencer);
    driver = new SequentialBuildDriver(evaluator);
    PrecomputedValue.BUILD_ID.set(differencer, UUID.randomUUID());
    PrecomputedValue.PATH_PACKAGE_LOCATOR.set(differencer, pkgLocator.get());
    PrecomputedValue.BLACKLISTED_PACKAGE_PREFIXES_FILE.set(differencer, PathFragment.EMPTY_FRAGMENT);
    createTestFiles();
}
Also used : PathPackageLocator(com.google.devtools.build.lib.pkgcache.PathPackageLocator) RecordingDifferencer(com.google.devtools.build.skyframe.RecordingDifferencer) SequentialBuildDriver(com.google.devtools.build.skyframe.SequentialBuildDriver) ManualClock(com.google.devtools.build.lib.testutil.ManualClock) InMemoryMemoizingEvaluator(com.google.devtools.build.skyframe.InMemoryMemoizingEvaluator) Before(org.junit.Before)

Example 23 with ManualClock

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

the class FileFunctionTest method createFsAndRoot.

@Before
public final void createFsAndRoot() throws Exception {
    fastDigest = true;
    manualClock = new ManualClock();
    createFsAndRoot(new CustomInMemoryFs(manualClock));
}
Also used : ManualClock(com.google.devtools.build.lib.testutil.ManualClock) Before(org.junit.Before)

Aggregations

ManualClock (com.google.devtools.build.lib.testutil.ManualClock)23 Test (org.junit.Test)16 LoggingTerminalWriter (com.google.devtools.build.lib.util.io.LoggingTerminalWriter)15 ActionStartedEvent (com.google.devtools.build.lib.actions.ActionStartedEvent)10 Label (com.google.devtools.build.lib.cmdline.Label)6 Before (org.junit.Before)6 Action (com.google.devtools.build.lib.actions.Action)5 ConfiguredTarget (com.google.devtools.build.lib.analysis.ConfiguredTarget)5 TestFilteringCompleteEvent (com.google.devtools.build.lib.buildtool.buildevent.TestFilteringCompleteEvent)5 ActionOwner (com.google.devtools.build.lib.actions.ActionOwner)3 InMemoryFileSystem (com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem)3 DownloadProgressEvent (com.google.devtools.build.lib.bazel.repository.downloader.DownloadProgressEvent)2 Path (com.google.devtools.build.lib.vfs.Path)2 URL (java.net.URL)2 ActionCompletionEvent (com.google.devtools.build.lib.actions.ActionCompletionEvent)1 ActionExecutionMetadata (com.google.devtools.build.lib.actions.ActionExecutionMetadata)1 Artifact (com.google.devtools.build.lib.actions.Artifact)1 PathPackageLocator (com.google.devtools.build.lib.pkgcache.PathPackageLocator)1 LoadingPhaseStartedEvent (com.google.devtools.build.lib.skyframe.LoadingPhaseStartedEvent)1 PackageProgressReceiver (com.google.devtools.build.lib.skyframe.PackageProgressReceiver)1