diff options
author | 2017-07-24 12:37:02 +0200 | |
---|---|---|
committer | 2017-07-24 13:19:00 +0200 | |
commit | 65c0872bdf451992fe2b62c2e308b5cc548212f5 (patch) | |
tree | 5c60b01cd941ec5f69aceea7c63b84fea19383b9 /src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java | |
parent | 83c267f4867b6f0b629f59d3e823c06ac5339a40 (diff) |
Handle multiple crosstool features providing the same symbol cleanly
It's bad to crash with an exception, let's show proper rule error instead.
RELNOTES: None.
PiperOrigin-RevId: 162916138
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java index e7b7671c31..8695ac517a 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java @@ -905,6 +905,26 @@ public class CcCommonTest extends BuildViewTestCase { .doesNotContain("third_party/_virtual_includes/a/third_party/a.h"); } + @Test + public void + testConfigureFeaturesDoesntCrashOnCollidingFeaturesExceptionButReportsRuleErrorCleanly() + throws Exception { + getAnalysisMock() + .ccSupport() + .setupCrosstool( + mockToolsConfig, + "feature { name: 'a1' provides: 'a' }", + "feature { name: 'a2' provides: 'a' }"); + useConfiguration("--features=a1", "--features=a2"); + + scratch.file("x/BUILD", "cc_library(name = 'foo', srcs = ['a.cc'])"); + scratch.file("x/a.cc"); + + reporter.removeHandler(failFastHandler); + getConfiguredTarget("//x:foo"); + assertContainsEvent("Symbol a is provided by all of the following features: a1 a2"); + } + /** * A {@code toolchain_type} rule for testing that only supports C++. */ |