diff options
author | 2018-07-26 14:38:51 -0700 | |
---|---|---|
committer | 2018-07-26 14:40:16 -0700 | |
commit | 7e87730de985b7099b9b683571d58efdaab70890 (patch) | |
tree | 42f4bba0c0f6d99455a68fc6beead8d2edb8fc08 /src/test/java/com/google/devtools/build/lib/skyframe/ParallelBuilderTest.java | |
parent | 0ccfde8b8bb646166a4f45c8630e8fe174f764f4 (diff) |
Remove default MD5 in most of Bazel's virtual filesystems.
This forces the ex-default to be explicit in a lot of tests, but I'd rather that than have the risk of implicit md5-use in production code.
To keep this CL smaller, do not remove the default from UnixFS quite yet.
RELNOTES: None.
PiperOrigin-RevId: 206223521
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skyframe/ParallelBuilderTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/skyframe/ParallelBuilderTest.java | 88 |
1 files changed, 45 insertions, 43 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/ParallelBuilderTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/ParallelBuilderTest.java index b03a0e9eae..9065ef17ab 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/ParallelBuilderTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/ParallelBuilderTest.java @@ -41,6 +41,7 @@ import com.google.devtools.build.lib.testutil.BlazeTestUtils; import com.google.devtools.build.lib.testutil.Suite; import com.google.devtools.build.lib.testutil.TestSpec; import com.google.devtools.build.lib.testutil.TestUtils; +import com.google.devtools.build.lib.vfs.DigestHashFunction; import com.google.devtools.build.lib.vfs.FileStatus; import com.google.devtools.build.lib.vfs.FileSystem; import com.google.devtools.build.lib.vfs.FileSystemUtils; @@ -238,58 +239,59 @@ public class ParallelBuilderTest extends TimestampBuilderTestCase { @Test public void testUpdateCacheError() throws Exception { - FileSystem fs = new InMemoryFileSystem() { - @Override - public FileStatus stat(Path path, boolean followSymlinks) throws IOException { - final FileStatus stat = super.stat(path, followSymlinks); - if (path.toString().endsWith("/out/foo")) { - return new FileStatus() { - private final FileStatus original = stat; + FileSystem fs = + new InMemoryFileSystem(DigestHashFunction.MD5) { + @Override + public FileStatus stat(Path path, boolean followSymlinks) throws IOException { + final FileStatus stat = super.stat(path, followSymlinks); + if (path.toString().endsWith("/out/foo")) { + return new FileStatus() { + private final FileStatus original = stat; - @Override - public boolean isSymbolicLink() { - return original.isSymbolicLink(); - } + @Override + public boolean isSymbolicLink() { + return original.isSymbolicLink(); + } - @Override - public boolean isFile() { - return original.isFile(); - } + @Override + public boolean isFile() { + return original.isFile(); + } - @Override - public boolean isDirectory() { - return original.isDirectory(); - } + @Override + public boolean isDirectory() { + return original.isDirectory(); + } - @Override - public boolean isSpecialFile() { - return original.isSpecialFile(); - } + @Override + public boolean isSpecialFile() { + return original.isSpecialFile(); + } - @Override - public long getSize() throws IOException { - return original.getSize(); - } + @Override + public long getSize() throws IOException { + return original.getSize(); + } - @Override - public long getNodeId() throws IOException { - return original.getNodeId(); - } + @Override + public long getNodeId() throws IOException { + return original.getNodeId(); + } - @Override - public long getLastModifiedTime() throws IOException { - throw new IOException(); - } + @Override + public long getLastModifiedTime() throws IOException { + throw new IOException(); + } - @Override - public long getLastChangeTime() throws IOException { - throw new IOException(); + @Override + public long getLastChangeTime() throws IOException { + throw new IOException(); + } + }; } - }; - } - return stat; - } - }; + return stat; + } + }; Artifact foo = createDerivedArtifact(fs, "foo"); registerAction(new TestAction(TestAction.NO_EFFECT, emptySet, ImmutableList.of(foo))); reporter.removeHandler(failFastHandler); |