diff options
author | 2018-02-15 21:10:22 -0800 | |
---|---|---|
committer | 2018-02-15 21:11:33 -0800 | |
commit | b653624e1e50cd0028305dddfddec4b73ec51f5a (patch) | |
tree | 1d63feef68c644de0f379721d9335deba3b83c4a /src/test/java/com/google/devtools/build | |
parent | 8c4c5eb324ead15bcf4476c1179dcffcd1caecf9 (diff) |
Remove BuildConfiguration and PlatformInfo from the
RegisteredExecutionPlatformsFunction.
PiperOrigin-RevId: 185947540
Diffstat (limited to 'src/test/java/com/google/devtools/build')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/skyframe/RegisteredExecutionPlatformsFunctionTest.java | 59 |
1 files changed, 20 insertions, 39 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/RegisteredExecutionPlatformsFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/RegisteredExecutionPlatformsFunctionTest.java index 08319a41e9..0d3e155407 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/RegisteredExecutionPlatformsFunctionTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/RegisteredExecutionPlatformsFunctionTest.java @@ -20,7 +20,6 @@ import static com.google.devtools.build.skyframe.EvaluationResultSubjectFactory. import com.google.common.collect.ImmutableList; import com.google.common.testing.EqualsTester; import com.google.common.truth.IterableSubject; -import com.google.devtools.build.lib.analysis.platform.PlatformInfo; import com.google.devtools.build.lib.analysis.platform.PlatformInfo.DuplicateConstraintException; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.rules.platform.ToolchainTestCase; @@ -55,31 +54,31 @@ public class RegisteredExecutionPlatformsFunctionTest extends ToolchainTestCase protected static IterableSubject assertExecutionPlatformLabels( RegisteredExecutionPlatformsValue registeredExecutionPlatformsValue) { assertThat(registeredExecutionPlatformsValue).isNotNull(); - ImmutableList<PlatformInfo> declaredExecutionPlatforms = - registeredExecutionPlatformsValue.registeredExecutionPlatforms(); - List<Label> labels = collectExecutionPlatformLabels(declaredExecutionPlatforms); + ImmutableList<ConfiguredTargetKey> declaredExecutionPlatformKeys = + registeredExecutionPlatformsValue.registeredExecutionPlatformKeys(); + List<Label> labels = collectExecutionPlatformLabels(declaredExecutionPlatformKeys); return assertThat(labels); } protected static List<Label> collectExecutionPlatformLabels( - List<PlatformInfo> executionPlatforms) { - return executionPlatforms + List<ConfiguredTargetKey> executionPlatformKeys) { + return executionPlatformKeys .stream() - .map((executionPlatform -> executionPlatform.label())) + .map(ConfiguredTargetKey::getLabel) .collect(Collectors.toList()); } @Test public void testRegisteredExecutionPlatforms() throws Exception { // Request the executionPlatforms. - SkyKey executionPlatformsKey = RegisteredExecutionPlatformsValue.key(targetConfig); + SkyKey executionPlatformsKey = RegisteredExecutionPlatformsValue.key(targetConfigKey); EvaluationResult<RegisteredExecutionPlatformsValue> result = requestExecutionPlatformsFromSkyframe(executionPlatformsKey); assertThatEvaluationResult(result).hasNoError(); assertThatEvaluationResult(result).hasEntryThat(executionPlatformsKey).isNotNull(); RegisteredExecutionPlatformsValue value = result.get(executionPlatformsKey); - assertThat(value.registeredExecutionPlatforms()).isEmpty(); + assertThat(value.registeredExecutionPlatformKeys()).isEmpty(); } @Test @@ -94,7 +93,7 @@ public class RegisteredExecutionPlatformsFunctionTest extends ToolchainTestCase rewriteWorkspace("register_execution_platforms('//extra:execution_platform_2')"); useConfiguration("--extra_execution_platforms=//extra:execution_platform_1"); - SkyKey executionPlatformsKey = RegisteredExecutionPlatformsValue.key(targetConfig); + SkyKey executionPlatformsKey = RegisteredExecutionPlatformsValue.key(targetConfigKey); EvaluationResult<RegisteredExecutionPlatformsValue> result = requestExecutionPlatformsFromSkyframe(executionPlatformsKey); assertThatEvaluationResult(result).hasNoError(); @@ -108,24 +107,6 @@ public class RegisteredExecutionPlatformsFunctionTest extends ToolchainTestCase } @Test - public void testRegisteredExecutionPlatforms_notExecutionPlatform() throws Exception { - rewriteWorkspace("register_execution_platforms(", " '//error:not_an_execution_platform')"); - scratch.file("error/BUILD", "filegroup(name = 'not_an_execution_platform')"); - - // Request the executionPlatforms. - SkyKey executionPlatformsKey = RegisteredExecutionPlatformsValue.key(targetConfig); - EvaluationResult<RegisteredExecutionPlatformsValue> result = - requestExecutionPlatformsFromSkyframe(executionPlatformsKey); - assertThatEvaluationResult(result) - .hasErrorEntryForKeyThat(executionPlatformsKey) - .hasExceptionThat() - .hasMessageThat() - .contains( - "invalid registered execution platform '//error:not_an_execution_platform': " - + "target does not provide the PlatformInfo provider"); - } - - @Test public void testRegisteredExecutionPlatforms_reload() throws Exception { scratch.file( "platform/BUILD", @@ -134,7 +115,7 @@ public class RegisteredExecutionPlatformsFunctionTest extends ToolchainTestCase rewriteWorkspace("register_execution_platforms('//platform:execution_platform_1')"); - SkyKey executionPlatformsKey = RegisteredExecutionPlatformsValue.key(targetConfig); + SkyKey executionPlatformsKey = RegisteredExecutionPlatformsValue.key(targetConfigKey); EvaluationResult<RegisteredExecutionPlatformsValue> result = requestExecutionPlatformsFromSkyframe(executionPlatformsKey); assertThatEvaluationResult(result).hasNoError(); @@ -144,7 +125,7 @@ public class RegisteredExecutionPlatformsFunctionTest extends ToolchainTestCase // Re-write the WORKSPACE. rewriteWorkspace("register_execution_platforms('//platform:execution_platform_2')"); - executionPlatformsKey = RegisteredExecutionPlatformsValue.key(targetConfig); + executionPlatformsKey = RegisteredExecutionPlatformsValue.key(targetConfigKey); result = requestExecutionPlatformsFromSkyframe(executionPlatformsKey); assertThatEvaluationResult(result).hasNoError(); assertExecutionPlatformLabels(result.get(executionPlatformsKey)) @@ -154,21 +135,21 @@ public class RegisteredExecutionPlatformsFunctionTest extends ToolchainTestCase @Test public void testRegisteredExecutionPlatformsValue_equalsAndHashCode() throws DuplicateConstraintException { - PlatformInfo executionPlatform1 = - PlatformInfo.builder().setLabel(makeLabel("//test:executionPlatform")).build(); - PlatformInfo executionPlatform2 = - PlatformInfo.builder().setLabel(makeLabel("//test:executionPlatform2")).build(); + ConfiguredTargetKey executionPlatformKey1 = + ConfiguredTargetKey.of(makeLabel("//test:executionPlatform1"), null, false); + ConfiguredTargetKey executionPlatformKey2 = + ConfiguredTargetKey.of(makeLabel("//test:executionPlatform2"), null, false); new EqualsTester() .addEqualityGroup( RegisteredExecutionPlatformsValue.create( - ImmutableList.of(executionPlatform1, executionPlatform2)), + ImmutableList.of(executionPlatformKey1, executionPlatformKey2)), RegisteredExecutionPlatformsValue.create( - ImmutableList.of(executionPlatform1, executionPlatform2))) + ImmutableList.of(executionPlatformKey1, executionPlatformKey2))) .addEqualityGroup( - RegisteredExecutionPlatformsValue.create(ImmutableList.of(executionPlatform1)), - RegisteredExecutionPlatformsValue.create(ImmutableList.of(executionPlatform2)), + RegisteredExecutionPlatformsValue.create(ImmutableList.of(executionPlatformKey1)), + RegisteredExecutionPlatformsValue.create(ImmutableList.of(executionPlatformKey2)), RegisteredExecutionPlatformsValue.create( - ImmutableList.of(executionPlatform2, executionPlatform1))); + ImmutableList.of(executionPlatformKey2, executionPlatformKey1))); } } |