use of com.google.devtools.build.lib.skyframe.RecursiveFilesystemTraversalValue.ResolvedFile in project bazel by bazelbuild.
the class RecursiveFilesystemTraversalFunctionTest method testFileMtimeChangeDoesNotCauseRebuildIfDigestIsUnchanged.
@Test
public void testFileMtimeChangeDoesNotCauseRebuildIfDigestIsUnchanged() throws Exception {
Artifact artifact = sourceArtifact("foo/bar.txt");
RootedPath path = rootedPath(artifact);
createFile(path, "hello");
// Assert that the SkyValue is built and looks right.
TraversalRequest params = fileLikeRoot(artifact, DONT_CROSS);
ResolvedFile expected = regularFileForTesting(path);
RecursiveFilesystemTraversalValue v1 = traverseAndAssertFiles(params, expected);
assertThat(progressReceiver.evaluations).contains(v1);
progressReceiver.clear();
// Change the mtime of the file but not the digest. See that the value is *not* rebuilt.
long mtime = path.asPath().getLastModifiedTime();
// more than the timestamp granularity of any filesystem
mtime += 1000000L;
path.asPath().setLastModifiedTime(mtime);
RecursiveFilesystemTraversalValue v2 = traverseAndAssertFiles(params, expected);
assertThat(v2).isEqualTo(v1);
assertTraversalRootHashesAreEqual(v1, v2);
}
Aggregations