aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com
diff options
context:
space:
mode:
authorGravatar mstaib <mstaib@google.com>2018-04-27 09:38:03 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-04-27 09:39:27 -0700
commit7afd69d431880ac81d01dc5cfa7e36bab37e7405 (patch)
tree1b1f1a6bd4fd1a3cef7dc3168edef9c495bd802c /src/test/java/com
parent6f24ee32e6d026553f55451b497de05c2bd5c90c (diff)
Reduce sensitivity of certain tests to exact configurations.
Because trimming will impact these tests, rephrasing them so that they don't depend on the exact configuration (but instead the actual properties they're trying to test) allows them to pass when the trimming transition is in place. RELNOTES: None. PiperOrigin-RevId: 194552473
Diffstat (limited to 'src/test/java/com')
-rw-r--r--src/test/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRuleConfiguredTargetTest.java6
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRuleConfiguredTargetTest.java b/src/test/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRuleConfiguredTargetTest.java
index a70e6946e9..7ced520c12 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRuleConfiguredTargetTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRuleConfiguredTargetTest.java
@@ -462,10 +462,12 @@ public class GenRuleConfiguredTargetTest extends BuildViewTestCase {
" srcs=[':src'], tools=[':tool'], outs=['out'],",
" cmd='$(location :tool)')");
+ ConfiguredTarget parentTarget = getConfiguredTarget("//config");
+
Iterable<ConfiguredTarget> prereqs =
Iterables.filter(
Iterables.filter(
- getDirectPrerequisites(getConfiguredTarget("//config")),
+ getDirectPrerequisites(parentTarget),
CC_CONFIGURED_TARGET_FILTER),
JAVA_CONFIGURED_TARGET_FILTER);
@@ -481,7 +483,7 @@ public class GenRuleConfiguredTargetTest extends BuildViewTestCase {
}
switch (name) {
case "src":
- assertConfigurationsEqual(getTargetConfiguration(), getConfiguration(prereq));
+ assertConfigurationsEqual(getConfiguration(parentTarget), getConfiguration(prereq));
foundSrc = true;
break;
case "tool":
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java
index ba6fa1d05e..8b4165baf2 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java
@@ -316,8 +316,10 @@ public class ConfigurationsForTargetsTest extends AnalysisTestCase {
"cc_binary(name = 'binary', srcs = ['main.cc'], deps = [':dep1', ':dep2'])");
List<ConfiguredTarget> deps = getConfiguredDeps("//a:binary", "deps");
assertThat(deps).hasSize(2);
+ BuildConfiguration topLevelConfiguration =
+ getConfiguration(Iterables.getOnlyElement(update("//a:binary").getTargetsToBuild()));
for (ConfiguredTarget dep : deps) {
- assertThat(getTargetConfiguration().equalsOrIsSupersetOf(getConfiguration(dep))).isTrue();
+ assertThat(topLevelConfiguration.equalsOrIsSupersetOf(getConfiguration(dep))).isTrue();
}
}