aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java
diff options
context:
space:
mode:
authorGravatar Nathan Harmata <nharmata@google.com>2016-06-06 18:41:48 +0000
committerGravatar Yun Peng <pcloudy@google.com>2016-06-07 07:48:14 +0000
commit2410ef4c777c6b4db397365ae5b78af3a9b3c446 (patch)
tree29e92af725a524b9a53481e13b08b7cdb0c70fe4 /src/test/java
parent7853e042aa484a957d952d848e79ff65e7156550 (diff)
Refactor UnixGlob by consolidating the context of a glob subtask into a GlobTaskContext object. Also dedupe identical recursive calls that arise from our naive implementation of the glob algorithm.
-- MOS_MIGRATED_REVID=124159729
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/vfs/RecursiveGlobTest.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/vfs/RecursiveGlobTest.java b/src/test/java/com/google/devtools/build/lib/vfs/RecursiveGlobTest.java
index 694a91d214..5e0f7875fe 100644
--- a/src/test/java/com/google/devtools/build/lib/vfs/RecursiveGlobTest.java
+++ b/src/test/java/com/google/devtools/build/lib/vfs/RecursiveGlobTest.java
@@ -154,6 +154,21 @@ public class RecursiveGlobTest {
.inOrder();
}
+ @Test
+ public void testRecursiveGlobsAreOptimized() throws Exception {
+ long numGlobTasks = new UnixGlob.Builder(tmpPath)
+ .addPattern("**")
+ .setExcludeDirectories(false)
+ .globInterruptibleAndReturnNumGlobTasksForTesting();
+
+ // The old glob implementation used to use 41 total glob tasks.
+ // Yes, checking for an exact value here is super brittle, but it lets us catch performance
+ // regressions. In other words, if you're a developer reading this comment because this test
+ // case is failing, you should be very sure you know what you're doing before you change the
+ // expectation of the test.
+ assertThat(numGlobTasks).isEqualTo(28);
+ }
+
private void assertIllegalWildcard(String pattern)
throws Exception {
try {