Skip to content

Commit

Permalink
Don't let the test exec group inherit from the default exec group
Browse files Browse the repository at this point in the history
Part of #24964.

RELNOTES[INC]: Constraints and toolchain requirements added to the default exec group, for example via the toolchains parameter of the rule function or the exec_compatible_with attribute on all rules, no longer apply to the test exec group, which contains the test action on test rules. Instead, use exec_group_compatible_with to apply constraints and/or define an explicit test exec group with toolchain requirements on test rules that require it.

PiperOrigin-RevId: 721834175
Change-Id: I8504ff1a08a643ed35a7282f09f6d6faf75d574c
  • Loading branch information
fmeum authored and copybara-github committed Jan 31, 2025
1 parent cb8d4da commit 38ee78c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ public class RuleClass implements RuleClassData {
public static final String APPLICABLE_METADATA_ATTR_ALT = "applicable_licenses";

public static final String DEFAULT_TEST_RUNNER_EXEC_GROUP_NAME = "test";
public static final ExecGroup DEFAULT_TEST_RUNNER_EXEC_GROUP = ExecGroup.COPY_FROM_DEFAULT;
// The test exec group should not inherit any exec constraints or toolchains from the default exec
// group since the execution platform for a test is generally independent (and often different)
// from the execution platform of the actions that produce the test executable.
public static final ExecGroup DEFAULT_TEST_RUNNER_EXEC_GROUP = ExecGroup.builder().build();

/** Interface for determining whether a rule needs toolchain resolution or not. */
@FunctionalInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -813,10 +813,6 @@ def _impl(ctx):
name = "gpu_platform",
constraint_values = [
"CONSTRAINTS_PACKAGE_ROOTos:linux",
# TODO: This constraint should not be needed, it's only required
# because default exec constraints implicitly leak into the
# 'test' exec group.
":has_fast_cpu",
":has_gpu",
],
exec_properties = {
Expand Down

0 comments on commit 38ee78c

Please sign in to comment.