use of com.google.devtools.build.skyframe.Differencer.Diff in project bazel by bazelbuild.
the class FilesystemValueCheckerTest method testFileWithIOExceptionNotConsideredDirty.
@Test
public void testFileWithIOExceptionNotConsideredDirty() throws Exception {
Path path = fs.getPath("/testroot/foo");
path.getParentDirectory().createDirectory();
path.createSymbolicLink(new PathFragment("bar"));
fs.readlinkThrowsIoException = true;
SkyKey fileKey = FileStateValue.key(RootedPath.toRootedPath(pkgRoot, new PathFragment("foo")));
EvaluationResult<SkyValue> result = driver.evaluate(ImmutableList.of(fileKey), false, SkyframeExecutor.DEFAULT_THREAD_COUNT, NullEventHandler.INSTANCE);
assertTrue(result.hasError());
fs.readlinkThrowsIoException = false;
FilesystemValueChecker checker = new FilesystemValueChecker(null, null);
Diff diff = getDirtyFilesystemKeys(evaluator, checker);
assertThat(diff.changedKeysWithoutNewValues()).isEmpty();
assertThat(diff.changedKeysWithNewValues()).isEmpty();
}
use of com.google.devtools.build.skyframe.Differencer.Diff in project bazel by bazelbuild.
the class InMemoryMemoizingEvaluator method evaluate.
@Override
public <T extends SkyValue> EvaluationResult<T> evaluate(Iterable<SkyKey> roots, Version version, boolean keepGoing, int numThreads, ExtendedEventHandler eventHandler) throws InterruptedException {
// NOTE: Performance critical code. See bug "Null build performance parity".
IntVersion intVersion = (IntVersion) version;
Preconditions.checkState((lastGraphVersion == null && intVersion.getVal() == 0) || version.equals(lastGraphVersion.next()), "InMemoryGraph supports only monotonically increasing Integer versions: %s %s", lastGraphVersion, version);
setAndCheckEvaluateState(true, roots);
try {
// Mark for removal any inflight nodes from the previous evaluation.
valuesToDelete.addAll(progressReceiver.getAndClearInflightKeys());
// The RecordingDifferencer implementation is not quite working as it should be at this point.
// It clears the internal data structures after getDiff is called and will not return
// diffs for historical versions. This makes the following code sensitive to interrupts.
// Ideally we would simply not update lastGraphVersion if an interrupt occurs.
Diff diff = differencer.getDiff(new DelegatingWalkableGraph(graph), lastGraphVersion, version);
valuesToInject.putAll(diff.changedKeysWithNewValues());
invalidate(diff.changedKeysWithoutNewValues());
pruneInjectedValues(valuesToInject);
invalidate(valuesToInject.keySet());
performInvalidation();
injectValues(intVersion);
ParallelEvaluator evaluator = new ParallelEvaluator(graph, intVersion, skyFunctions, eventHandler, emittedEventState, DEFAULT_STORED_EVENT_FILTER, keepGoing, numThreads, progressReceiver);
EvaluationResult<T> result = evaluator.eval(roots);
return EvaluationResult.<T>builder().mergeFrom(result).setWalkableGraph(new DelegatingWalkableGraph(graph)).build();
} finally {
lastGraphVersion = intVersion;
setAndCheckEvaluateState(false, roots);
}
}
use of com.google.devtools.build.skyframe.Differencer.Diff in project bazel by bazelbuild.
the class FilesystemValueCheckerTest method testFilesInCycleNotConsideredDirty.
@Test
public void testFilesInCycleNotConsideredDirty() throws Exception {
Path path1 = pkgRoot.getRelative("foo1");
Path path2 = pkgRoot.getRelative("foo2");
Path path3 = pkgRoot.getRelative("foo3");
FileSystemUtils.ensureSymbolicLink(path1, path2);
FileSystemUtils.ensureSymbolicLink(path2, path3);
FileSystemUtils.ensureSymbolicLink(path3, path1);
SkyKey fileKey1 = FileValue.key(RootedPath.toRootedPath(pkgRoot, path1));
EvaluationResult<SkyValue> result = driver.evaluate(ImmutableList.of(fileKey1), false, SkyframeExecutor.DEFAULT_THREAD_COUNT, NullEventHandler.INSTANCE);
assertTrue(result.hasError());
FilesystemValueChecker checker = new FilesystemValueChecker(null, null);
Diff diff = getDirtyFilesystemKeys(evaluator, checker);
assertThat(diff.changedKeysWithoutNewValues()).isEmpty();
assertThat(diff.changedKeysWithNewValues()).isEmpty();
}
Aggregations