diff options
author | Rumou Duan <rduan@google.com> | 2016-06-17 16:43:44 +0000 |
---|---|---|
committer | Philipp Wollermann <philwo@google.com> | 2016-06-20 09:34:39 +0000 |
commit | 45e8e57fb3a12537a19859f299e672bfa9558286 (patch) | |
tree | 469e9115141a9f15f07b9f89618f4ccf6f465e56 /src/test/java/com/google/devtools/build | |
parent | 01a78e7ea1d81ef1c59efbde6cb437c956155fc7 (diff) |
In FileSystemValueChecker, only check TreeArtfacts that are in the
passed-in modified file sets.
--
MOS_MIGRATED_REVID=125173579
Diffstat (limited to 'src/test/java/com/google/devtools/build')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java index b457c00aac..54b65cbe98 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java @@ -411,6 +411,9 @@ public class FilesystemValueCheckerTest { Artifact outUnchanging = createTreeArtifact("untouched"); FileSystemUtils.createDirectoryAndParents(outUnchanging.getPath()); + Artifact last = createTreeArtifact("zzzzzzzzzz"); + FileSystemUtils.createDirectoryAndParents(last.getPath()); + Action action1 = new TestAction( Runnables.doNothing(), ImmutableSet.<Artifact>of(), ImmutableSet.of(out1)); @@ -423,6 +426,9 @@ public class FilesystemValueCheckerTest { Action actionUnchanging = new TestAction( Runnables.doNothing(), ImmutableSet.<Artifact>of(), ImmutableSet.of(outUnchanging)); + Action lastAction = + new TestAction( + Runnables.doNothing(), ImmutableSet.<Artifact>of(), ImmutableSet.of(last)); differencer.inject( ImmutableMap.<SkyKey, SkyValue>of( ActionExecutionValue.key(action1), @@ -432,7 +438,9 @@ public class FilesystemValueCheckerTest { ActionExecutionValue.key(actionEmpty), actionValueWithEmptyDirectory(outEmpty), ActionExecutionValue.key(actionUnchanging), - actionValueWithEmptyDirectory(outUnchanging))); + actionValueWithEmptyDirectory(outUnchanging), + ActionExecutionValue.key(lastAction), + actionValueWithEmptyDirectory(last))); assertFalse( driver @@ -510,6 +518,48 @@ public class FilesystemValueCheckerTest { .build())) .containsExactly(ActionExecutionValue.key(action1), ActionExecutionValue.key(action2), ActionExecutionValue.key(actionEmpty)); + // We also check that if the modified file set does not contain our modified files on disk, + // we are not going to check and return them. + assertThat( + new FilesystemValueChecker(null, null).getDirtyActionValues(evaluator.getValues(), + batchStatter, + new ModifiedFileSet.Builder() + .modify(file21.getExecPath()) + .modify(outEmptyNew.getExecPath()) + .build())) + .containsExactly(ActionExecutionValue.key(action2), ActionExecutionValue.key(actionEmpty)); + assertThat( + new FilesystemValueChecker(null, null).getDirtyActionValues(evaluator.getValues(), + batchStatter, + new ModifiedFileSet.Builder() + .modify(file21.getExecPath()) + .modify(out1new.getExecPath()) + .build())) + .containsExactly(ActionExecutionValue.key(action1), ActionExecutionValue.key(action2)); + // Check modifying the last (lexicographically) tree artifact. + last.getPath().delete(); + assertThat( + new FilesystemValueChecker(null, null).getDirtyActionValues(evaluator.getValues(), + batchStatter, + new ModifiedFileSet.Builder() + .modify(file21.getExecPath()) + .modify(out1new.getExecPath()) + .modify(last.getExecPath()) + .build())) + .containsExactly(ActionExecutionValue.key(action1), ActionExecutionValue.key(action2), + ActionExecutionValue.key(lastAction)); + // Check ModifiedFileSet without the last (lexicographically) tree artifact. + assertThat( + new FilesystemValueChecker(null, null).getDirtyActionValues(evaluator.getValues(), + batchStatter, + new ModifiedFileSet.Builder() + .modify(file21.getExecPath()) + .modify(out1new.getExecPath()) + .build())) + .containsExactly(ActionExecutionValue.key(action1), ActionExecutionValue.key(action2)); + // Restore + last.getPath().delete(); + FileSystemUtils.createDirectoryAndParents(last.getPath()); // We add a test for NOTHING_MODIFIED, because FileSystemValueChecker doesn't // pay attention to file sets for TreeArtifact directory listings. assertThat( |