Search in sources :

Example 11 with ResolvedFile

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);
}
Also used : TraversalRequest(com.google.devtools.build.lib.skyframe.RecursiveFilesystemTraversalValue.TraversalRequest) ResolvedFile(com.google.devtools.build.lib.skyframe.RecursiveFilesystemTraversalValue.ResolvedFile) Artifact(com.google.devtools.build.lib.actions.Artifact) RootedPath(com.google.devtools.build.lib.vfs.RootedPath) Test(org.junit.Test)

Aggregations

ResolvedFile (com.google.devtools.build.lib.skyframe.RecursiveFilesystemTraversalValue.ResolvedFile)11 TraversalRequest (com.google.devtools.build.lib.skyframe.RecursiveFilesystemTraversalValue.TraversalRequest)8 RootedPath (com.google.devtools.build.lib.vfs.RootedPath)8 Artifact (com.google.devtools.build.lib.actions.Artifact)7 Test (org.junit.Test)5 PathFragment (com.google.devtools.build.lib.vfs.PathFragment)3 FilesetOutputSymlink (com.google.devtools.build.lib.actions.FilesetOutputSymlink)1 FilesetTraversalParams (com.google.devtools.build.lib.actions.FilesetTraversalParams)1 DirectTraversal (com.google.devtools.build.lib.actions.FilesetTraversalParams.DirectTraversal)1 DanglingSymlinkException (com.google.devtools.build.lib.skyframe.RecursiveFilesystemTraversalFunction.DanglingSymlinkException)1 SkyKey (com.google.devtools.build.skyframe.SkyKey)1 SkyValue (com.google.devtools.build.skyframe.SkyValue)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1