diff options
author | cpeyser <cpeyser@google.com> | 2017-08-28 22:43:32 +0200 |
---|---|---|
committer | Vladimir Moskva <vladmos@google.com> | 2017-08-29 13:32:14 +0200 |
commit | 03755ea2a9830d94fdb23baa3b37bb11c2faa392 (patch) | |
tree | 0884dfe0d360aed55e8febc2b02d1271a71894d7 /src | |
parent | 8c76d5f82d290b46d67189bcc8bd08a441094da1 (diff) |
Automated rollback of commit 363413110f3a63a11d900864be1852adbaed2899.
*** Reason for rollback ***
Breaks //src/test/shell/bazel:bazel_bootstrap_distfile_test:
INFO: You can skip this first step by providing a path to the bazel binary as second argument:
INFO: ./compile.sh compile /path/to/bazel
🍃 Building Bazel from scratch......
🍃 Building Bazel with Bazel.
.WARNING: /tmp/bazel_cHivhPBc/out/external/bazel_tools/WORKSPACE:1: Workspace name in /tmp/bazel_cHivhPBc/out/external/bazel_tools/WORKSPACE (@io_bazel) does not match the name given in the repository's definition (@bazel_tools); this will cause a build error in future versions.
ERROR: in target '//external:cc_toolchain': error loading package '@local_config_cc//': Extension file not found. Unable to load file '@local_config_cc//:dummy_toolchain.bzl': file doesn't exist or isn't a file.
INFO: Elapsed time: 3.343s
ERROR: Could not build Bazel
Found by git bisect.
*** Original change description ***
Add a new toolchain type for c++. In order to do this, PlatformConfiguration is made a legal configuration fragment for every rule class.
Add a default "dummy" c++ toolchain to prevent resolution errors when legacy toolchain selection logic is used. Add toolchain mocks to java and shell tests.
PiperOrigin-RevId: 166750885
Diffstat (limited to 'src')
15 files changed, 54 insertions, 149 deletions
diff --git a/src/create_embedded_tools.py b/src/create_embedded_tools.py index 668db213fe..699edd09f5 100644 --- a/src/create_embedded_tools.py +++ b/src/create_embedded_tools.py @@ -29,8 +29,8 @@ from src.create_embedded_tools_lib import is_executable output_paths = [ ('*tools/jdk/BUILD*', lambda x: 'tools/jdk/BUILD'), - ('*tools/platforms/platforms.BUILD', lambda x: 'tools/platforms/BUILD'), - ('*tools/platforms/*', lambda x: 'tools/platforms/' + os.path.basename(x)), + ('*tools/platforms/platforms.BUILD', lambda x: 'platforms/BUILD'), + ('*tools/platforms/*', lambda x: 'platforms/' + os.path.basename(x)), ('*JavaBuilder*_deploy.jar', lambda x: 'tools/jdk/' + os.path.basename(x)), ('*JacocoCoverage*_deploy.jar', lambda x: 'tools/jdk/JacocoCoverage_deploy.jar'), diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java b/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java index f52d66f209..817f4d163e 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java @@ -182,60 +182,41 @@ public class BaseRuleClasses { * Share common attributes across both base and Skylark base rules. */ public static RuleClass.Builder commonCoreAndSkylarkAttributes(RuleClass.Builder builder) { - return PlatformSemantics.platformAttributes(builder) + return builder // The visibility attribute is special: it is a nodep label, and loading the // necessary package groups is handled by {@link LabelVisitor#visitTargetVisibility}. // Package groups always have the null configuration so that they are not duplicated // needlessly. - .add( - attr("visibility", NODEP_LABEL_LIST) - .orderIndependent() - .cfg(HOST) - .nonconfigurable( - "special attribute integrated more deeply into Bazel's core logic")) - .add( - attr("deprecation", STRING) - .value(deprecationDefault) - .nonconfigurable("Used in core loading phase logic with no access to configs")) - .add( - attr("tags", STRING_LIST) - .orderIndependent() - .taggable() - .nonconfigurable("low-level attribute, used in TargetUtils without configurations")) - .add( - attr("generator_name", STRING) - .undocumented("internal") - .nonconfigurable("static structure of a rule")) - .add( - attr("generator_function", STRING) - .undocumented("internal") - .nonconfigurable("static structure of a rule")) - .add( - attr("generator_location", STRING) - .undocumented("internal") - .nonconfigurable("static structure of a rule")) - .add( - attr("testonly", BOOLEAN) - .value(testonlyDefault) - .nonconfigurable("policy decision: rules testability should be consistent")) + .add(attr("visibility", NODEP_LABEL_LIST).orderIndependent().cfg(HOST) + .nonconfigurable("special attribute integrated more deeply into Bazel's core logic")) + .add(attr("deprecation", STRING).value(deprecationDefault) + .nonconfigurable("Used in core loading phase logic with no access to configs")) + .add(attr("tags", STRING_LIST).orderIndependent().taggable() + .nonconfigurable("low-level attribute, used in TargetUtils without configurations")) + .add(attr("generator_name", STRING).undocumented("internal") + .nonconfigurable("static structure of a rule")) + .add(attr("generator_function", STRING).undocumented("internal") + .nonconfigurable("static structure of a rule")) + .add(attr("generator_location", STRING).undocumented("internal") + .nonconfigurable("static structure of a rule")) + .add(attr("testonly", BOOLEAN).value(testonlyDefault) + .nonconfigurable("policy decision: rules testability should be consistent")) .add(attr("features", STRING_LIST).orderIndependent()) .add(attr(":action_listener", LABEL_LIST).cfg(HOST).value(ACTION_LISTENER)) - .add( - attr(RuleClass.COMPATIBLE_ENVIRONMENT_ATTR, LABEL_LIST) - .allowedRuleClasses(EnvironmentRule.RULE_NAME) - .cfg(Attribute.ConfigurationTransition.HOST) - .allowedFileTypes(FileTypeSet.NO_FILE) - .dontCheckConstraints() - .nonconfigurable( - "special logic for constraints and select: see ConstraintSemantics")) - .add( - attr(RuleClass.RESTRICTED_ENVIRONMENT_ATTR, LABEL_LIST) - .allowedRuleClasses(EnvironmentRule.RULE_NAME) - .cfg(Attribute.ConfigurationTransition.HOST) - .allowedFileTypes(FileTypeSet.NO_FILE) - .dontCheckConstraints() - .nonconfigurable( - "special logic for constraints and select: see ConstraintSemantics")); + .add(attr(RuleClass.COMPATIBLE_ENVIRONMENT_ATTR, LABEL_LIST) + .allowedRuleClasses(EnvironmentRule.RULE_NAME) + .cfg(Attribute.ConfigurationTransition.HOST) + .allowedFileTypes(FileTypeSet.NO_FILE) + .dontCheckConstraints() + .nonconfigurable("special logic for constraints and select: see ConstraintSemantics") + ) + .add(attr(RuleClass.RESTRICTED_ENVIRONMENT_ATTR, LABEL_LIST) + .allowedRuleClasses(EnvironmentRule.RULE_NAME) + .cfg(Attribute.ConfigurationTransition.HOST) + .allowedFileTypes(FileTypeSet.NO_FILE) + .dontCheckConstraints() + .nonconfigurable("special logic for constraints and select: see ConstraintSemantics") + ); } public static RuleClass.Builder nameAttribute(RuleClass.Builder builder) { diff --git a/src/main/java/com/google/devtools/build/lib/analysis/PlatformOptions.java b/src/main/java/com/google/devtools/build/lib/analysis/PlatformOptions.java index dd65946476..3376e9609d 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/PlatformOptions.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/PlatformOptions.java @@ -36,7 +36,7 @@ public class PlatformOptions extends FragmentOptions { @Option( name = "experimental_host_platform", converter = BuildConfiguration.LabelConverter.class, - defaultValue = "@bazel_tools//tools/platforms:host_platform", + defaultValue = "@bazel_tools//platforms:host_platform", documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, effectTags = {OptionEffectTag.UNKNOWN}, metadataTags = {OptionMetadataTag.HIDDEN}, @@ -49,7 +49,7 @@ public class PlatformOptions extends FragmentOptions { @Option( name = "experimental_platforms", converter = BuildConfiguration.LabelListConverter.class, - defaultValue = "@bazel_tools//tools/platforms:target_platform", + defaultValue = "@bazel_tools//platforms:target_platform", documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, effectTags = {OptionEffectTag.UNKNOWN}, metadataTags = {OptionMetadataTag.HIDDEN}, @@ -60,7 +60,7 @@ public class PlatformOptions extends FragmentOptions { @Option( name = "extra_toolchains", converter = LabelListConverter.class, - defaultValue = "@bazel_tools//tools/cpp:dummy_cc_toolchain", + defaultValue = "", documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, effectTags = {OptionEffectTag.UNKNOWN}, metadataTags = {OptionMetadataTag.HIDDEN}, @@ -98,8 +98,6 @@ public class PlatformOptions extends FragmentOptions { public PlatformOptions getHost(boolean fallback) { PlatformOptions host = (PlatformOptions) getDefault(); host.platforms = ImmutableList.of(this.hostPlatform); - host.hostPlatform = this.hostPlatform; - host.extraToolchains = this.extraToolchains; return host; } diff --git a/src/main/java/com/google/devtools/build/lib/analysis/PlatformSemantics.java b/src/main/java/com/google/devtools/build/lib/analysis/PlatformSemantics.java index 45c967e551..d93c5a6dea 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/PlatformSemantics.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/PlatformSemantics.java @@ -26,7 +26,6 @@ import com.google.devtools.build.lib.packages.AttributeMap; import com.google.devtools.build.lib.packages.Rule; import com.google.devtools.build.lib.packages.RuleClass; import java.util.List; -import javax.annotation.Nullable; /** Helper class to manage rules' use of platforms. */ public class PlatformSemantics { @@ -41,22 +40,19 @@ public class PlatformSemantics { @Override public List<Label> resolve( Rule rule, AttributeMap attributes, BuildConfiguration configuration) { - // rule may be null for tests - if (rule == null || rule.getRuleClassObject().getRequiredToolchains().isEmpty()) { - return ImmutableList.of(); + if (rule.getRuleClassObject().getRequiredToolchains().isEmpty()) { + return null; } return configuration.getFragment(PlatformConfiguration.class).getTargetPlatforms(); } }; /** Implementation for the :execution_platform attribute. */ - @Nullable public static final Attribute.LateBoundLabel<BuildConfiguration> EXECUTION_PLATFORM = new Attribute.LateBoundLabel<BuildConfiguration>(PlatformConfiguration.class) { @Override public Label resolve(Rule rule, AttributeMap attributes, BuildConfiguration configuration) { - // rule may be null for tests - if (rule == null || rule.getRuleClassObject().getRequiredToolchains().isEmpty()) { + if (rule.getRuleClassObject().getRequiredToolchains().isEmpty()) { return null; } return configuration.getFragment(PlatformConfiguration.class).getExecutionPlatform(); diff --git a/src/main/java/com/google/devtools/build/lib/analysis/ToolchainContext.java b/src/main/java/com/google/devtools/build/lib/analysis/ToolchainContext.java index 16a29fd5df..9cbdd475ac 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/ToolchainContext.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/ToolchainContext.java @@ -142,8 +142,6 @@ public class ToolchainContext { prerequisiteMap .keys() .stream() - // Keys in prerequisiteMap can be null, see {@link DependencyResolver#dependentNodeMap}. - .filter(attribute -> attribute != null) .filter(attribute -> attribute.getName().equals(PlatformSemantics.TOOLCHAINS_ATTR)) .findFirst(); Preconditions.checkState( diff --git a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleClassFunctions.java b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleClassFunctions.java index 6c8487364d..3e850d966d 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleClassFunctions.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleClassFunctions.java @@ -39,6 +39,7 @@ import com.google.devtools.build.lib.analysis.ActionsProvider; import com.google.devtools.build.lib.analysis.BaseRuleClasses; import com.google.devtools.build.lib.analysis.DefaultInfo; import com.google.devtools.build.lib.analysis.OutputGroupProvider; +import com.google.devtools.build.lib.analysis.PlatformSemantics; import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; import com.google.devtools.build.lib.analysis.skylark.SkylarkAttr.Descriptor; import com.google.devtools.build.lib.analysis.test.TestConfiguration; @@ -128,9 +129,10 @@ public class SkylarkRuleClassFunctions { /** Parent rule class for non-executable non-test Skylark rules. */ public static final RuleClass baseRule = BaseRuleClasses.commonCoreAndSkylarkAttributes( - BaseRuleClasses.nameAttribute( - new RuleClass.Builder("$base_rule", RuleClassType.ABSTRACT, true)) - .add(attr("expect_failure", STRING))) + PlatformSemantics.platformAttributes( + BaseRuleClasses.nameAttribute( + new RuleClass.Builder("$base_rule", RuleClassType.ABSTRACT, true)) + .add(attr("expect_failure", STRING)))) .build(); /** Parent rule class for executable non-test Skylark rules. */ diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java index dba13389ff..2b4666a781 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java @@ -57,7 +57,6 @@ import com.google.devtools.build.lib.packages.TriState; import com.google.devtools.build.lib.rules.cpp.CcToolchain; import com.google.devtools.build.lib.rules.cpp.CppConfiguration; import com.google.devtools.build.lib.rules.cpp.CppFileTypes; -import com.google.devtools.build.lib.rules.cpp.CppHelper; import com.google.devtools.build.lib.rules.cpp.CppRuleClasses; import com.google.devtools.build.lib.rules.cpp.CppRuleClasses.LipoTransition; import com.google.devtools.build.lib.util.FileTypeSet; @@ -140,7 +139,6 @@ public class BazelCppRuleClasses { attr(CcToolchain.CC_TOOLCHAIN_DEFAULT_ATTRIBUTE_NAME, LABEL) .value(CppRuleClasses.ccToolchainAttribute(env))) .setPreferredDependencyPredicate(Predicates.<String>or(CPP_SOURCE, C_SOURCE, CPP_HEADER)) - .addRequiredToolchains(CppHelper.getCcToolchainType(env.getToolsRepository())) .build(); } diff --git a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java index 565cb7a222..7cbb25fd1b 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java +++ b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java @@ -28,7 +28,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; import com.google.common.collect.Ordering; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.cmdline.LabelSyntaxException; @@ -997,11 +996,6 @@ public class RuleClass { return this; } - public Builder addRequiredToolchains(Label... toolchainLabels) { - Iterables.addAll(this.requiredToolchains, Lists.newArrayList(toolchainLabels)); - return this; - } - /** * Returns an Attribute.Builder object which contains a replica of the * same attribute in the parent rule if exists. diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java index 87f43cc057..1100576151 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java @@ -87,11 +87,6 @@ public class CppHelper { private static final ImmutableList<String> LINKOPTS_PREREQUISITE_LABEL_KINDS = ImmutableList.of("deps", "srcs"); - /** Returns label used to select resolved cc_toolchain instances based on platform. */ - public static Label getCcToolchainType(String toolsRepository) { - return Label.parseAbsoluteUnchecked(toolsRepository + "//tools/cpp:toolchain_type"); - } - private CppHelper() { // prevents construction } diff --git a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java index 83bcdad904..183c8c05f7 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java @@ -1238,8 +1238,8 @@ public class BuildViewTest extends BuildViewTestBase { useConfiguration("--experimental_dynamic_configs=on"); AnalysisResult res = update("//foo:x"); ConfiguredTarget topLevelTarget = Iterables.getOnlyElement(res.getTargetsToBuild()); - assertThat(topLevelTarget.getConfiguration().getAllFragments().keySet()) - .containsExactly(ruleClassProvider.getUniversalFragment(), PlatformConfiguration.class); + assertThat(topLevelTarget.getConfiguration().getAllFragments().keySet()).containsExactly( + ruleClassProvider.getUniversalFragment()); } @Test diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/BazelMockCcSupport.java b/src/test/java/com/google/devtools/build/lib/packages/util/BazelMockCcSupport.java index 296cd82c3c..0defa523b1 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/util/BazelMockCcSupport.java +++ b/src/test/java/com/google/devtools/build/lib/packages/util/BazelMockCcSupport.java @@ -77,6 +77,7 @@ public final class BazelMockCcSupport extends MockCcSupport { config.create( "/bazel_tools_workspace/tools/cpp/BUILD", "package(default_visibility=['//visibility:public'])", + "toolchain_type(name = 'toolchain_type')", "cc_library(name = 'stl')", "cc_library(name = 'malloc')", "cc_toolchain_suite(", @@ -122,7 +123,7 @@ public final class BazelMockCcSupport extends MockCcSupport { " linker_files = ':empty',", " module_map = 'crosstool.cppmap', supports_header_parsing = 1,", " objcopy_files = ':empty', static_runtime_libs = [':empty'], strip_files = ':empty',", - ")", + ")", "cc_toolchain(name = 'cc-compiler-armeabi-v7a', all_files = ':empty', ", " compiler_files = ':empty',", " cpu = 'local', dwp_files = ':empty', dynamic_runtime_libs = [':empty'], ", @@ -144,27 +145,8 @@ public final class BazelMockCcSupport extends MockCcSupport { "filegroup(", " name = 'link_dynamic_library',", " srcs = ['link_dynamic_library.sh'],", - ")", - "toolchain(", - " name = 'toolchain_cc-compiler-piii',", - " toolchain_type = ':toolchain_type',", - " toolchain = '//third_party/crosstool/mock:cc-compiler-piii',", - " target_compatible_with = [':mock_value'],", - ")", - "toolchain_type(name = 'toolchain_type')", - "toolchain(", - " name = 'dummy_cc_toolchain',", - " toolchain_type = ':toolchain_type',", - " toolchain = ':dummy_cc_toolchain_impl',", - ")", - "load(':dummy_toolchain.bzl', 'dummy_toolchain')", - "dummy_toolchain(name = 'dummy_cc_toolchain_impl')"); - config.create( - "/bazel_tools_workspace/tools/cpp/dummy_toolchain.bzl", - "def _dummy_toolchain_impl(ctx):", - " toolchain = platform_common.ToolchainInfo()", - " return [toolchain]", - "dummy_toolchain = rule(_dummy_toolchain_impl, attrs = {})"); + ")"); + config.create( "/bazel_tools_workspace/tools/cpp/CROSSTOOL", readCrosstoolFile()); @@ -174,7 +156,6 @@ public final class BazelMockCcSupport extends MockCcSupport { config.create("tools/cpp/link_dynamic_library.sh", ""); } MockObjcSupport.setup(config); - MockPlatformSupport.setup(config, "/bazel_tools_workspace/tools/platforms"); } @Override diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/MockPlatformSupport.java b/src/test/java/com/google/devtools/build/lib/packages/util/MockPlatformSupport.java deleted file mode 100644 index f2d89fbbe4..0000000000 --- a/src/test/java/com/google/devtools/build/lib/packages/util/MockPlatformSupport.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2017 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package com.google.devtools.build.lib.packages.util; - -import java.io.IOException; - -/** Mocking support for platforms and toolchains. */ -public class MockPlatformSupport { - - /** Adds mocks for basic host and target platform. */ - public static void setup(MockToolsConfig mockToolsConfig, String platformsPath) - throws IOException { - mockToolsConfig.create( - platformsPath + "/BUILD", - "package(default_visibility=['//visibility:public'])", - "platform(", - " name = 'target_platform',", - " target_platform = True,", - ")", - "platform(", - " name = 'host_platform',", - " host_platform = True,", - ")"); - } -} diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java index 2ff18b4379..2547d354f3 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java @@ -977,7 +977,6 @@ public class CcCommonTest extends BuildViewTestCase { BazelRuleClassProvider.BAZEL_SETUP.init(builder); CoreRules.INSTANCE.init(builder); BazelRuleClassProvider.CORE_WORKSPACE_RULES.init(builder); - BazelRuleClassProvider.PLATFORM_RULES.init(builder); BazelRuleClassProvider.GENERIC_RULES.init(builder); BazelRuleClassProvider.CPP_RULES.init(builder); builder.addRuleDefinition(new OnlyCppToolchainTypeRule()); 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 1c0f5697f1..86bbf073f6 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 @@ -57,10 +57,9 @@ public class RegisteredToolchainsFunctionTest extends ToolchainTestCase { assertThatEvaluationResult(result).hasEntryThat(toolchainsKey).isNotNull(); RegisteredToolchainsValue value = result.get(toolchainsKey); - // We have two registered toolchains, and one default for c++ - assertThat(value.registeredToolchains()).hasSize(3); + assertThat(value.registeredToolchains()).hasSize(2); - DeclaredToolchainInfo registeredToolchain1 = value.registeredToolchains().get(1); + DeclaredToolchainInfo registeredToolchain1 = value.registeredToolchains().get(0); assertThat(registeredToolchain1).isNotNull(); assertThat(registeredToolchain1.toolchainType()).isEqualTo(testToolchainType); @@ -69,7 +68,7 @@ public class RegisteredToolchainsFunctionTest extends ToolchainTestCase { assertThat(registeredToolchain1.toolchainLabel()) .isEqualTo(makeLabel("//toolchain:test_toolchain_1")); - DeclaredToolchainInfo registeredToolchain2 = value.registeredToolchains().get(2); + DeclaredToolchainInfo registeredToolchain2 = value.registeredToolchains().get(1); assertThat(registeredToolchain2).isNotNull(); assertThat(registeredToolchain2.toolchainType()).isEqualTo(testToolchainType); @@ -138,7 +137,7 @@ public class RegisteredToolchainsFunctionTest extends ToolchainTestCase { requestToolchainsFromSkyframe(toolchainsKey); assertThatEvaluationResult(result).hasNoError(); assertToolchainLabels(result.get(toolchainsKey)) - .contains(makeLabel("//toolchain:test_toolchain_1")); + .containsExactly(makeLabel("//toolchain:test_toolchain_1")); // Re-write the WORKSPACE. rewriteWorkspace("register_toolchains('//toolchain:toolchain_2')"); @@ -147,7 +146,7 @@ public class RegisteredToolchainsFunctionTest extends ToolchainTestCase { result = requestToolchainsFromSkyframe(toolchainsKey); assertThatEvaluationResult(result).hasNoError(); assertToolchainLabels(result.get(toolchainsKey)) - .contains(makeLabel("//toolchain:test_toolchain_2")); + .containsExactly(makeLabel("//toolchain:test_toolchain_2")); } @Test diff --git a/src/test/shell/integration/discard_graph_edges_test.sh b/src/test/shell/integration/discard_graph_edges_test.sh index aeedbeba90..3325eae86e 100755 --- a/src/test/shell/integration/discard_graph_edges_test.sh +++ b/src/test/shell/integration/discard_graph_edges_test.sh @@ -193,7 +193,7 @@ function test_packages_cleared() { || fail "env extension count $env_count too low: did you move/rename the class?" local ct_count="$(extract_histogram_count "$histo_file" \ 'RuleConfiguredTarget$')" - [[ "ct_count" -ge 40 ]] \ + [[ "ct_count" -ge 28 ]] \ || fail "RuleConfiguredTarget count $ct_count too low: did you move/rename the class?" local histo_file="$(prepare_histogram "$BUILD_FLAGS")" package_count="$(extract_histogram_count "$histo_file" \ |