aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build
diff options
context:
space:
mode:
authorGravatar Greg Estren <gregce@google.com>2016-08-02 21:45:35 +0000
committerGravatar Yun Peng <pcloudy@google.com>2016-08-03 07:58:07 +0000
commit2bc883876a7aad341a2620b5c0865beaeec13ec4 (patch)
tree700812c36bdbd2f425d633b9c5d0dc67adeeaee7 /src/test/java/com/google/devtools/build
parent50283f47d8a7958fe8841ce64e5d068ebf7ada97 (diff)
Provides a clearer message when target analysis fails because its dynamic
config is missing required fragments. Before this change, Bazel crashes with the mysterious error: "Fragment foo can't load missing options BarOptions" with no details on which target or dep needed Foo. So figuring out the source of the error is painful. With this change, we instead get: //foo:foo: dependency //bar:bar from attribute "deps" is missing required config fragments: JavaConfiguration -- MOS_MIGRATED_REVID=129143764
Diffstat (limited to 'src/test/java/com/google/devtools/build')
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java
index 3efe26b16d..8d45c93362 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java
@@ -1230,6 +1230,28 @@ public class BuildViewTest extends BuildViewTestBase {
ruleClassProvider.getUniversalFragment());
}
+ @Test
+ public void errorOnMissingDepFragments() throws Exception {
+ scratch.file("foo/BUILD",
+ "cc_library(",
+ " name = 'ccbin', ",
+ " srcs = ['c.cc'],",
+ " data = [':javalib'])",
+ "java_library(",
+ " name = 'javalib',",
+ " srcs = ['javalib.java'])");
+ useConfiguration("--experimental_dynamic_configs", "--experimental_disable_jvm");
+ reporter.removeHandler(failFastHandler);
+ try {
+ update("//foo:ccbin");
+ fail();
+ } catch (ViewCreationFailedException e) {
+ // Expected.
+ }
+ assertContainsEvent("//foo:ccbin: dependency //foo:javalib from attribute \"data\" is missing "
+ + "required config fragments: Jvm");
+ }
+
/** Runs the same test with the reduced loading phase. */
@TestSpec(size = Suite.SMALL_TESTS)
@RunWith(JUnit4.class)