diff options
author | 2015-11-25 20:50:39 +0000 | |
---|---|---|
committer | 2015-11-26 13:18:21 +0000 | |
commit | 9ef5982ad71c5f92f84308bb50ed880f5913ea00 (patch) | |
tree | 5ac7ada890712aed54f104b958fa8086959f8820 /src | |
parent | ea19988d7f4745af9b9df163774256c9fad0cf20 (diff) |
Add test for globbing across a package boundary in a different package path.
--
MOS_MIGRATED_REVID=108731914
Diffstat (limited to 'src')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/skyframe/GlobFunctionTest.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/GlobFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/GlobFunctionTest.java index 9956a5e561..a03a107e08 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/GlobFunctionTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/GlobFunctionTest.java @@ -90,6 +90,7 @@ public abstract class GlobFunctionTest { private SequentialBuildDriver driver; private RecordingDifferencer differencer; private Path root; + private Path writableRoot; private Path outputBase; private Path pkgPath; private AtomicReference<PathPackageLocator> pkgLocator; @@ -102,10 +103,13 @@ public abstract class GlobFunctionTest { fs = new CustomInMemoryFs(new ManualClock()); root = fs.getRootDirectory().getRelative("root/workspace"); + writableRoot = fs.getRootDirectory().getRelative("writableRoot/workspace"); outputBase = fs.getRootDirectory().getRelative("output_base"); pkgPath = root.getRelative(PKG_PATH_ID.getPackageFragment()); - pkgLocator = new AtomicReference<>(new PathPackageLocator(outputBase, ImmutableList.of(root))); + pkgLocator = + new AtomicReference<>( + new PathPackageLocator(outputBase, ImmutableList.of(writableRoot, root))); tsgm = new TimestampGranularityMonitor(BlazeClock.instance()); differencer = new RecordingDifferencer(); @@ -311,6 +315,15 @@ public abstract class GlobFunctionTest { assertGlobMatches("foo/**", /* => */ "foo", "foo/barnacle", "foo/barnacle/wiz"); } + @Test + public void testGlobDoesNotCrossPackageBoundaryUnderOtherPackagePath() throws Exception { + FileSystemUtils.createDirectoryAndParents(writableRoot.getRelative("pkg/foo/bar")); + FileSystemUtils.createEmptyFile(writableRoot.getRelative("pkg/foo/bar/BUILD")); + // "foo/bar" should not be in the results because foo/bar is detected as a separate package, + // even though it is under a different package path. + assertGlobMatches("foo/**", /* => */ "foo", "foo/barnacle", "foo/barnacle/wiz"); + } + private void assertGlobMatches(String pattern, String... expecteds) throws Exception { assertGlobMatches(false, pattern, expecteds); } |