aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com
diff options
context:
space:
mode:
authorGravatar Greg Estren <gregce@google.com>2016-06-08 20:12:40 +0000
committerGravatar Yun Peng <pcloudy@google.com>2016-06-09 08:02:17 +0000
commit42c49355e5d20b03b2d25212e39a64d0198c832a (patch)
tree4133e28501e5c8b78bf712a1755340d1a7970fb4 /src/test/java/com
parent073147bc41906f206fd9a0c060358694a220d0cc (diff)
Provide means to clearly fail tests that fail because dynamic configs
don't yet support fragments from late-bound attributes. This is intended to extend to any other class of errors that can't already be centrally encoded somewhere in the production logic. -- MOS_MIGRATED_REVID=124384937
Diffstat (limited to 'src/test/java/com')
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java4
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/util/ExpectedDynamicConfigurationErrors.java25
2 files changed, 29 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 20f47e13c6..bc8eccb86b 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
@@ -40,6 +40,7 @@ import com.google.devtools.build.lib.analysis.BuildView.AnalysisResult;
import com.google.devtools.build.lib.analysis.config.InvalidConfigurationException;
import com.google.devtools.build.lib.analysis.util.AnalysisMock;
import com.google.devtools.build.lib.analysis.util.BuildViewTestBase;
+import com.google.devtools.build.lib.analysis.util.ExpectedDynamicConfigurationErrors;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.packages.Attribute;
import com.google.devtools.build.lib.packages.Rule;
@@ -865,6 +866,9 @@ public class BuildViewTest extends BuildViewTestBase {
"cc_binary(name = 'cpp', data = [':java'])");
// Everything is fine - the dependency graph is acyclic.
update("//foo:java", "//foo:cpp");
+ if (getTargetConfiguration().useDynamicConfigurations()) {
+ fail(ExpectedDynamicConfigurationErrors.LATE_BOUND_ATTRIBUTES_UNSUPPORTED);
+ }
// Now there will be an analysis-phase cycle because the java_binary now has an implicit dep on
// the cc_binary launcher.
useConfiguration("--java_launcher=//foo:cpp");
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/ExpectedDynamicConfigurationErrors.java b/src/test/java/com/google/devtools/build/lib/analysis/util/ExpectedDynamicConfigurationErrors.java
new file mode 100644
index 0000000000..fb9fecf174
--- /dev/null
+++ b/src/test/java/com/google/devtools/build/lib/analysis/util/ExpectedDynamicConfigurationErrors.java
@@ -0,0 +1,25 @@
+// Copyright 2016 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package com.google.devtools.build.lib.analysis.util;
+
+/**
+ * Reference point for expected test failures when dynamic configurations are enabled.
+ *
+ * <p>Every Bazel test should either succeed with --experimental_dynamic_configs or
+ * fail with a clear reason due to known features gaps.
+ */
+public class ExpectedDynamicConfigurationErrors {
+ public static final String LATE_BOUND_ATTRIBUTES_UNSUPPORTED =
+ "dynamic configurations don't yet support fragments from late-bound dependencies";
+}