aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/skyframe/RegisteredExecutionPlatformsFunctionTest.java
diff options
context:
space:
mode:
authorGravatar John Cater <jcater@google.com>2018-03-12 18:50:56 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-03-12 18:53:23 -0700
commit0084e16b55ad54f7aeeffd6d003ea3506039d957 (patch)
tree306210efed020fe8a7fd8645e383d8fe4e3b2947 /src/test/java/com/google/devtools/build/lib/skyframe/RegisteredExecutionPlatformsFunctionTest.java
parentcf37b4f3e44564a154ea0535efa61c6c673bab52 (diff)
Fix toolchain and execution platform registration to use patterns.
This allows more flexibility in registering toolchains and execution platforms, both in the WORKSPACE and from the command-line. Change-Id: I6fe75507d1a74de74085b7c927fdf093c152b894 PiperOrigin-RevId: 188813688
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skyframe/RegisteredExecutionPlatformsFunctionTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/RegisteredExecutionPlatformsFunctionTest.java48
1 files changed, 48 insertions, 0 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 c00261969c..21d1229436 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
@@ -108,6 +108,54 @@ public class RegisteredExecutionPlatformsFunctionTest extends ToolchainTestCase
}
@Test
+ public void testRegisteredExecutionPlatforms_targetPattern_workspace() throws Exception {
+
+ // Add an extra execution platform.
+ scratch.file(
+ "extra/BUILD",
+ "platform(name = 'execution_platform_1')",
+ "platform(name = 'execution_platform_2')");
+
+ rewriteWorkspace("register_execution_platforms('//extra/...')");
+
+ SkyKey executionPlatformsKey = RegisteredExecutionPlatformsValue.key(targetConfigKey);
+ EvaluationResult<RegisteredExecutionPlatformsValue> result =
+ requestExecutionPlatformsFromSkyframe(executionPlatformsKey);
+ assertThatEvaluationResult(result).hasNoError();
+
+ // Verify that the target registered with the extra_execution_platforms flag is first in the
+ // list.
+ assertExecutionPlatformLabels(result.get(executionPlatformsKey))
+ .containsAllOf(
+ makeLabel("//extra:execution_platform_1"), makeLabel("//extra:execution_platform_2"))
+ .inOrder();
+ }
+
+ @Test
+ public void testRegisteredExecutionPlatforms_targetPattern_flagOverride() throws Exception {
+
+ // Add an extra execution platform.
+ scratch.file(
+ "extra/BUILD",
+ "platform(name = 'execution_platform_1')",
+ "platform(name = 'execution_platform_2')");
+
+ useConfiguration("--extra_execution_platforms=//extra/...");
+
+ SkyKey executionPlatformsKey = RegisteredExecutionPlatformsValue.key(targetConfigKey);
+ EvaluationResult<RegisteredExecutionPlatformsValue> result =
+ requestExecutionPlatformsFromSkyframe(executionPlatformsKey);
+ assertThatEvaluationResult(result).hasNoError();
+
+ // Verify that the target registered with the extra_execution_platforms flag is first in the
+ // list.
+ assertExecutionPlatformLabels(result.get(executionPlatformsKey))
+ .containsAllOf(
+ makeLabel("//extra:execution_platform_1"), makeLabel("//extra:execution_platform_2"))
+ .inOrder();
+ }
+
+ @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')");