diff options
author | 2015-11-13 21:25:41 +0000 | |
---|---|---|
committer | 2015-11-16 09:00:40 +0000 | |
commit | 81e093e4bfc73b2b4e607ebf904781041d0da4a3 (patch) | |
tree | 99da549af98d19733ac6475e6f23cb4e27e122e3 /src/test/java/com/google | |
parent | 50230466ff83b9981cdd1826180b8a94bc413211 (diff) |
Fix crash when two Skylark loads reference the same path.
--
MOS_MIGRATED_REVID=107808413
Diffstat (limited to 'src/test/java/com/google')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupFunctionTest.java | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupFunctionTest.java index 6b60f076c9..546caf3088 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupFunctionTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupFunctionTest.java @@ -87,6 +87,21 @@ public class SkylarkImportLookupFunctionTest extends BuildViewTestCase { get(key("//pkg3:ext.bzl")); } + public void testLoadFromSameAbsolutePathTwice() throws Exception { + scratch.file("pkg1/BUILD"); + scratch.file("pkg2/BUILD"); + scratch.file("pkg1/ext.bzl", "a = 1", "b = 2"); + scratch.file("pkg2/ext.bzl", "load('/pkg1/ext', 'a')", "load('/pkg1/ext', 'b')"); + get(key("//pkg1:ext.bzl")); + } + + public void testLoadFromSameRelativePathTwice() throws Exception { + scratch.file("pkg/BUILD"); + scratch.file("pkg/ext1.bzl", "a = 1", "b = 2"); + scratch.file("pkg/ext2.bzl", "load('ext1', 'a')", "load('ext1', 'b')"); + get(key("//pkg:ext1.bzl")); + } + private EvaluationResult<SkylarkImportLookupValue> get(SkyKey skylarkImportLookupKey) throws Exception { EvaluationResult<SkylarkImportLookupValue> result = @@ -102,10 +117,11 @@ public class SkylarkImportLookupFunctionTest extends BuildViewTestCase { return SkylarkImportLookupValue.key(Label.parseAbsoluteUnchecked(label)); } - private void checkLabel(String file, String label) throws Exception { - SkyKey skylarkImportLookupKey = key(file); + private void checkLabel(String labelRequested, String labelFound) throws Exception { + SkyKey skylarkImportLookupKey = key(labelRequested); EvaluationResult<SkylarkImportLookupValue> result = get(skylarkImportLookupKey); - assertEquals(label, result.get(skylarkImportLookupKey).getDependency().getLabel().toString()); + assertEquals(labelFound, + result.get(skylarkImportLookupKey).getDependency().getLabel().toString()); } public void testSkylarkImportLookupNoBuildFile() throws Exception { |