aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test
diff options
context:
space:
mode:
authorGravatar Greg Estren <gregce@google.com>2016-06-01 23:22:48 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-06-02 11:44:02 +0000
commit7971e674fadbb41123271a86a2c4418e8c0f42a6 (patch)
tree3a9d3c16aaa4397228ed2614843a95794eb687b8 /src/test
parent8c77715e6fa8f536dd16c7b5af14d367e1e0e96c (diff)
Dynamic configurations: trim top-level targets, too.
Right now, configuration trimming happens in ConfiguredTargetFunction.computeDependencies. This means only the deps of other targets get trimmed. With this change, every ConfiguredTarget gets its configuration accurately trimmed, regardless of where it comes from or what it's used for. In practice, there could still be other code paths that instantiate ConfiguredTargetValue.key without pre-trimming. We'll have to tackle those as we hit them. Also cleaned up some symbol naming in BuildView.update to try to make the logic flow clearer. TESTED: BuildViewTest#testNewActionsAreDifferentAndDontConflict now passes with dynamic configs (among others) -- MOS_MIGRATED_REVID=123807892
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java19
1 files changed, 16 insertions, 3 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 6bb032534f..20f47e13c6 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
@@ -151,8 +151,8 @@ public class BuildViewTest extends BuildViewTestBase {
OutputFileConfiguredTarget outputCT = (OutputFileConfiguredTarget)
getConfiguredTarget("//pkg:a.out");
Artifact outputArtifact = outputCT.getArtifact();
- assertEquals(getTargetConfiguration().getBinDirectory(), outputArtifact.getRoot());
- assertEquals(getTargetConfiguration().getBinFragment().getRelative("pkg/a.out"),
+ assertEquals(outputCT.getConfiguration().getBinDirectory(), outputArtifact.getRoot());
+ assertEquals(outputCT.getConfiguration().getBinFragment().getRelative("pkg/a.out"),
outputArtifact.getExecPath());
assertEquals(new PathFragment("pkg/a.out"), outputArtifact.getRootRelativePath());
@@ -345,7 +345,7 @@ public class BuildViewTest extends BuildViewTestBase {
fileDependency =
Dependency.withTransitionAndAspects(
Label.parseAbsolute("//package:file"),
- Attribute.ConfigurationTransition.NONE,
+ Attribute.ConfigurationTransition.NULL,
ImmutableSet.<AspectDescriptor>of());
} else {
innerDependency =
@@ -1214,6 +1214,19 @@ public class BuildViewTest extends BuildViewTestBase {
+ "by '//parent:a'", 1);
}
+ @Test
+ public void testTopLevelTargetsAreTrimmedWithDynamicConfigurations() throws Exception {
+ scratch.file("foo/BUILD",
+ "sh_library(name='x', ",
+ " srcs=['x.sh'])");
+ useConfiguration("--experimental_dynamic_configs");
+ AnalysisResult res = update("//foo:x");
+ ConfiguredTarget topLevelTarget = Iterables.getOnlyElement(res.getTargetsToBuild());
+ assertThat(topLevelTarget.getConfiguration().getAllFragments().keySet()).containsExactly(
+ ruleClassProvider.getUniversalFragment());
+ }
+
+
/** Runs the same test with the reduced loading phase. */
@TestSpec(size = Suite.SMALL_TESTS)
@RunWith(JUnit4.class)