aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java
diff options
context:
space:
mode:
authorGravatar Damien Martin-Guillerez <dmarting@google.com>2016-12-06 20:41:47 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-12-06 21:05:01 +0000
commit95f9b8129d1b877523359ca26539cb254ae5a8d7 (patch)
treea21a919acccc9a772f6f820d476b18cea6e66db2 /src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java
parentd6885e2efd61ab282578b54a584e105bb3b83574 (diff)
*** Reason for rollback *** Still fails bazel-tests See http://ci.bazel.io/job/bazel-tests/BAZEL_VERSION=HEAD,PLATFORM_NAME=ubuntu_15.10-x86_64/lastCompletedBuild/testReport/ for instance *** Original change description *** Provide deterministic order for split configured deps (roll forward) Also: - Make ConfiguredTargetFunction.getDynamicConfigurations more readable. - Add a bit more testing coverage for configured dep resolution. This is a roll forward of commit 7505d94c19727e3100ac5e16a960bff2cb324f23. The original changed failed on Windows because "ppc" wasn't recognized as a valid cpu: https://github.com/bazelbuild/bazel/issues/2191 This version uses "armeabi-v7a" instead. -- PiperOrigin-RevId: 141212457 MOS_MIGRATED_REVID=141212457
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java48
1 files changed, 3 insertions, 45 deletions
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 64e54d92f0..e6bfebc8ac 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
@@ -50,8 +50,7 @@ import com.google.devtools.build.skyframe.SkyFunctionException;
import com.google.devtools.build.skyframe.SkyFunctionName;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-import java.util.List;
-
+import java.util.Collection;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@@ -210,12 +209,12 @@ public class ConfigurationsForTargetsTest extends AnalysisTestCase {
*
* <p>Throws an exception if the attribute can't be found.
*/
- private List<ConfiguredTarget> getConfiguredDeps(String targetLabel, String attrName)
+ private Collection<ConfiguredTarget> getConfiguredDeps(String targetLabel, String attrName)
throws Exception {
Multimap<Attribute, ConfiguredTarget> allDeps = getConfiguredDeps(targetLabel);
for (Attribute attribute : allDeps.keySet()) {
if (attribute.getName().equals(attrName)) {
- return ImmutableList.copyOf(allDeps.get(attribute));
+ return allDeps.get(attribute);
}
}
throw new AssertionError(
@@ -262,47 +261,6 @@ public class ConfigurationsForTargetsTest extends AnalysisTestCase {
assertThat(genIn.getConfiguration()).isNull();
}
- @Test
- public void targetDeps() throws Exception {
- scratch.file(
- "a/BUILD",
- "cc_library(name = 'dep1', srcs = ['dep1.cc'])",
- "cc_library(name = 'dep2', srcs = ['dep2.cc'])",
- "cc_binary(name = 'binary', srcs = ['main.cc'], deps = [':dep1', ':dep2'])");
- List<ConfiguredTarget> deps = getConfiguredDeps("//a:binary", "deps");
- assertThat(deps).hasSize(2);
- for (ConfiguredTarget dep : deps) {
- assertThat(getTargetConfiguration().equalsOrIsSupersetOf(dep.getConfiguration())).isTrue();
- }
- }
-
- @Test
- public void hostDeps() throws Exception {
- scratch.file(
- "a/BUILD",
- "cc_binary(name = 'host_tool', srcs = ['host_tool.cc'])",
- "genrule(name = 'gen', srcs = [], cmd = '', outs = ['gen.out'], tools = [':host_tool'])");
- ConfiguredTarget toolDep = Iterables.getOnlyElement(getConfiguredDeps("//a:gen", "tools"));
- assertThat(toolDep.getConfiguration().isHostConfiguration()).isTrue();
- }
-
- @Test
- public void splitDeps() throws Exception {
- scratch.file(
- "java/a/BUILD",
- "cc_library(name = 'lib', srcs = ['lib.cc'])",
- "android_binary(name='a', manifest = 'mainfest.xml', deps = [':lib'])");
- useConfiguration("--fat_apk_cpu=k8,armeabi-v7a");
- List<ConfiguredTarget> deps = getConfiguredDeps("//java/a:a", "deps");
- assertThat(deps).hasSize(2);
- assertThat(
- ImmutableList.<String>of(
- deps.get(0).getConfiguration().getCpu(),
- deps.get(1).getConfiguration().getCpu()))
- .containsExactly("armeabi-v7a", "k8")
- .inOrder(); // We don't care what order split deps are listed, but it must be deterministic.
- }
-
/** Runs the same test with trimmed dynamic configurations. */
@TestSpec(size = Suite.SMALL_TESTS)
@RunWith(JUnit4.class)