aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/skyframe/RegisteredToolchainsFunctionTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skyframe/RegisteredToolchainsFunctionTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/RegisteredToolchainsFunctionTest.java70
1 files changed, 69 insertions, 1 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/RegisteredToolchainsFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/RegisteredToolchainsFunctionTest.java
index d405ef8186..311cd5ad0a 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/RegisteredToolchainsFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/RegisteredToolchainsFunctionTest.java
@@ -41,7 +41,7 @@ public class RegisteredToolchainsFunctionTest extends ToolchainTestCase {
assertThatEvaluationResult(result).hasEntryThat(toolchainsKey).isNotNull();
RegisteredToolchainsValue value = result.get(toolchainsKey);
- // We have two registered toolchains, and a default for c++
+ // We have two registered toolchains, and a default toolchain for C++.
assertThat(value.registeredToolchains()).hasSize(3);
assertThat(
@@ -124,6 +124,74 @@ public class RegisteredToolchainsFunctionTest extends ToolchainTestCase {
}
@Test
+ public void testRegisteredToolchains_targetPattern_workspace() throws Exception {
+ scratch.appendFile("extra/BUILD", "filegroup(name = 'not_a_platform')");
+ addToolchain(
+ "extra",
+ "extra_toolchain1",
+ ImmutableList.of("//constraints:linux"),
+ ImmutableList.of("//constraints:linux"),
+ "foo");
+ addToolchain(
+ "extra",
+ "extra_toolchain2",
+ ImmutableList.of("//constraints:linux"),
+ ImmutableList.of("//constraints:mac"),
+ "bar");
+ addToolchain(
+ "extra/more",
+ "more_toolchain",
+ ImmutableList.of("//constraints:mac"),
+ ImmutableList.of("//constraints:linux"),
+ "baz");
+ rewriteWorkspace("register_toolchains('//extra/...')");
+
+ SkyKey toolchainsKey = RegisteredToolchainsValue.key(targetConfigKey);
+ EvaluationResult<RegisteredToolchainsValue> result =
+ requestToolchainsFromSkyframe(toolchainsKey);
+ assertThatEvaluationResult(result).hasNoError();
+ assertToolchainLabels(result.get(toolchainsKey))
+ .containsAllOf(
+ makeLabel("//extra:extra_toolchain1_impl"),
+ makeLabel("//extra:extra_toolchain2_impl"),
+ makeLabel("//extra/more:more_toolchain_impl"));
+ }
+
+ @Test
+ public void testRegisteredToolchains_targetPattern_flagOverride() throws Exception {
+ scratch.appendFile("extra/BUILD", "filegroup(name = 'not_a_platform')");
+ addToolchain(
+ "extra",
+ "extra_toolchain1",
+ ImmutableList.of("//constraints:linux"),
+ ImmutableList.of("//constraints:linux"),
+ "foo");
+ addToolchain(
+ "extra",
+ "extra_toolchain2",
+ ImmutableList.of("//constraints:linux"),
+ ImmutableList.of("//constraints:mac"),
+ "bar");
+ addToolchain(
+ "extra/more",
+ "more_toolchain",
+ ImmutableList.of("//constraints:mac"),
+ ImmutableList.of("//constraints:linux"),
+ "baz");
+ useConfiguration("--extra_toolchains=//extra/...");
+
+ SkyKey toolchainsKey = RegisteredToolchainsValue.key(targetConfigKey);
+ EvaluationResult<RegisteredToolchainsValue> result =
+ requestToolchainsFromSkyframe(toolchainsKey);
+ assertThatEvaluationResult(result).hasNoError();
+ assertToolchainLabels(result.get(toolchainsKey))
+ .containsAllOf(
+ makeLabel("//extra:extra_toolchain1_impl"),
+ makeLabel("//extra:extra_toolchain2_impl"),
+ makeLabel("//extra/more:more_toolchain_impl"));
+ }
+
+ @Test
public void testRegisteredToolchains_reload() throws Exception {
rewriteWorkspace("register_toolchains('//toolchain:toolchain_1')");