Don't treat empty files specially with respect to mtime/digest.
RELNOTES: Bazel no longer regards an empty file as changed if its mtime has changed.
--
MOS_MIGRATED_REVID=127328552
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/TimestampBuilderTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/TimestampBuilderTest.java
index 55f1784..ea10d33 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/TimestampBuilderTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/TimestampBuilderTest.java
@@ -169,8 +169,8 @@
buildArtifacts(cachingBuilder(), goodbye);
assertFalse(button.pressed); // not rebuilt
- // inMemoryMetadataCache.useFileDigest is false, so new timestamp is enough to force a rebuild.
- FileSystemUtils.touchFile(hello.getPath());
+ hello.getPath().setWritable(true);
+ FileSystemUtils.writeContentAsLatin1(hello.getPath(), "new content");
button.pressed = false;
buildArtifacts(cachingBuilder(), goodbye);
@@ -231,10 +231,10 @@
buildArtifacts(cachingBuilder(), hello);
assertFalse(button.pressed); // not rebuilt
- // Touching the *output* file 'hello' causes 'action' to re-execute, to
- // make things consistent again; this is not what Make would do, but it is
- // correct according to this Builder.
- BlazeTestUtils.changeModtime(hello.getPath());
+ // Changing the *output* file 'hello' causes 'action' to re-execute, to make things consistent
+ // again.
+ hello.getPath().setWritable(true);
+ FileSystemUtils.writeContentAsLatin1(hello.getPath(), "new content");
button.pressed = false;
buildArtifacts(cachingBuilder(), hello);
@@ -251,7 +251,8 @@
Artifact hello = createSourceArtifact("hello");
BlazeTestUtils.makeEmptyFile(hello.getPath());
Artifact wazuup = createDerivedArtifact("wazuup");
- Button button1 = createActionButton(Sets.newHashSet(hello), Sets.newHashSet(wazuup));
+ Button button1 = new Button();
+ registerAction(new CopyingAction(button1, hello, wazuup));
Artifact goodbye = createDerivedArtifact("goodbye");
Button button2 = createActionButton(Sets.newHashSet(wazuup), Sets.newHashSet(goodbye));
@@ -275,7 +276,8 @@
assertFalse(button1.pressed); // wazuup not rebuilt
assertFalse(button2.pressed); // goodbye not rebuilt
- FileSystemUtils.touchFile(hello.getPath());
+ hello.getPath().setWritable(true);
+ FileSystemUtils.writeContentAsLatin1(hello.getPath(), "new content");
button1.pressed = button2.pressed = false;
buildArtifacts(cachingBuilder(), goodbye);