Let DirectoryListingStateFunction re-use the PerBuildSyscallCache. The listing
function performs a readdir() that we will likely have already executed earlier
for globbing.
RELNOTES: None.
PiperOrigin-RevId: 233908833
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 34fd0d5..9c00e7f 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
@@ -236,6 +236,11 @@
/** Regression test for unexpected exception type from PackageValue. */
@Test
public void testDiscrepancyBetweenLegacyAndSkyframePackageLoadingErrors() throws Exception {
+ // Normally, legacy globbing and skyframe globbing share a cache for `readdir` filesystem calls.
+ // In order to exercise a situation where they observe different results for filesystem calls,
+ // we disable the cache. This might happen in a real scenario, e.g. if the cache hits a limit
+ // and evicts entries.
+ getSkyframeExecutor().turnOffSyscallCacheForTesting();
reporter.removeHandler(failFastHandler);
Path fooBuildFile =
scratch.file("foo/BUILD", "sh_library(name = 'foo', srcs = glob(['bar/*.sh']))");