Introduce a FileSystemCalls.getType() function that just returns the type of a
file in question. In quite a few places that is sufficient and we might be able
to get the result based on a previously existing readdir() or stat() request if
we have either of them cached.
While at it, re-use the PerBuildSysCall cache inside of FileStateFunction in
order to profit from this.
This can prevent a whole bunch of unnecessary stat() calls, especially for
whether or not a BUILD file is present and for creating the FileStateValue for
symlinks and directories (for regular files we still need to stat() in order to
get modification time information).
RELNOTES: None.
PiperOrigin-RevId: 240794051
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java
index d6ead22..06c8a81 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java
@@ -199,6 +199,7 @@
@Test
public void testPropagatesFilesystemInconsistencies_Globbing() throws Exception {
+ getSkyframeExecutor().turnOffSyscallCacheForTesting();
reporter.removeHandler(failFastHandler);
RecordingDifferencer differencer = getSkyframeExecutor().getDifferencerForTesting();
Root pkgRoot = getSkyframeExecutor().getPathEntries().get(0);