Skip to content

Commit 4b98a9d

Browse files
gregestrencopybara-github
authored andcommitted
Update test exec platform documentation.
Default behavior changed at 0dd0da9. Also space out some paragraphs more to de-densify content. Closes #27750. PiperOrigin-RevId: 840133157 Change-Id: Icf233c4617da7c06a5f6256f14571f703b726f24
1 parent 64d9fb1 commit 4b98a9d

File tree

2 files changed

+58
-36
lines changed

2 files changed

+58
-36
lines changed

docs/reference/test-encyclopedia.mdx

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -703,26 +703,35 @@ via [toolchain resolution](/extending/toolchains#toolchain-resolution), just
703703
like for any other action. Each test rule has an implicitly defined [
704704
`test` exec group](/extending/exec-groups#exec-groups-for-native-rules) that,
705705
unless overridden, has a mandatory toolchain requirement on
706-
`@bazel_tools//tools/test:default_test_toolchain_type`. Toolchains of this type
707-
do not carry any data in the form of providers, but can be used to influence the
708-
execution platform of the test action. By default, Bazel registers two such
709-
toolchains:
706+
`@bazel_tools//tools/test:default_test_toolchain_type`.
707+
708+
Toolchains of this type do not carry any data in the form of providers, but can
709+
be used to influence the execution platform of the test action.
710+
711+
Bazel registers two such toolchains, which take effect if users don't explicitly
712+
define their own::
710713

711714
* If `--@bazel_tools//tools/test:incompatible_use_default_test_toolchain` is
712-
disabled (the current default), the active test toolchain is
713-
`@bazel_tools//tools/test:legacy_test_toolchain`. This toolchain does not
714-
impose any constraints and thus test actions without manually specified exec
715-
constraints are configured for the first registered execution platform. This
716-
is often not the intended behavior in multi-platform builds as it can result
717-
in e.g. a test binary built for Linux on a Windows machine to be executed on
718-
Windows.
719-
* If `--@bazel_tools//tools/test:incompatible_use_default_test_toolchain` is
720-
enabled, the active test toolchain is
715+
enabled (**default**), the active test toolchain is
721716
`@bazel_tools//tools/test:default_test_toolchain`. This toolchain requires an
722-
execution platform to match all the constraints of the test rule's target
723-
platform. In particular, the target platform is compatible with this toolchain
717+
execution platform to match all of the test rule's target platform
718+
constraints.
719+
720+
In particular, the target platform is compatible with this toolchain
724721
if it is also registered as an execution platform. If no such platform is
725-
found, the test rule fails with a toolchain resolution error.
722+
found, the test rule fails with a toolchain resolution error
723+
* If `--@bazel_tools//tools/test:incompatible_use_default_test_toolchain` is
724+
disabled, the active test toolchain is
725+
`@bazel_tools//tools/test:legacy_test_toolchain`. This toolchain does not
726+
impose any constraints and thus test actions without manually specified exec
727+
constraints are configured for the first registered execution platform.
728+
729+
This is often not the intended behavior in multi-platform builds as it can
730+
result in, for example, a test binary built for Linux on a Windows machine to
731+
be executed on Windows.
732+
733+
As a legacy setting, expect this option to be unavailable in a future Bazel
734+
release.
726735

727736
Users can register additional toolchains for this type to influence this
728737
behavior and their toolchains will take precedence over the default ones.
@@ -731,8 +740,10 @@ a default toolchain for it.
731740

732741
## Tag conventions {:#tag-conventions}
733742

734-
Some tags in the test rules have a special meaning. See also the
735-
[Bazel Build Encyclopedia on the `tags` attribute](/reference/be/common-definitions#common.tags).
743+
Some tags in the test rules have a special meaning.
744+
See also the
745+
[Bazel Build Encyclopedia on the `tags` attribute]
746+
(/reference/be/common-definitions#common.tags).
736747

737748
<table>
738749
<tr>

site/en/reference/test-encyclopedia.md

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -706,26 +706,35 @@ via [toolchain resolution](/extending/toolchains#toolchain-resolution), just
706706
like for any other action. Each test rule has an implicitly defined [
707707
`test` exec group](/extending/exec-groups#exec-groups-for-native-rules) that,
708708
unless overridden, has a mandatory toolchain requirement on
709-
`@bazel_tools//tools/test:default_test_toolchain_type`. Toolchains of this type
710-
do not carry any data in the form of providers, but can be used to influence the
711-
execution platform of the test action. By default, Bazel registers two such
712-
toolchains:
709+
`@bazel_tools//tools/test:default_test_toolchain_type`.
710+
711+
Toolchains of this type don't carry any data in the form of providers, but can
712+
be used to influence the execution platform of the test action.
713+
714+
Bazel registers two such toolchains, which take effect if users don't explicitly
715+
define their own::
713716

714717
* If `--@bazel_tools//tools/test:incompatible_use_default_test_toolchain` is
715-
disabled (the current default), the active test toolchain is
716-
`@bazel_tools//tools/test:legacy_test_toolchain`. This toolchain does not
717-
impose any constraints and thus test actions without manually specified exec
718-
constraints are configured for the first registered execution platform. This
719-
is often not the intended behavior in multi-platform builds as it can result
720-
in e.g. a test binary built for Linux on a Windows machine to be executed on
721-
Windows.
722-
* If `--@bazel_tools//tools/test:incompatible_use_default_test_toolchain` is
723-
enabled, the active test toolchain is
718+
enabled (**default**), the active test toolchain is
724719
`@bazel_tools//tools/test:default_test_toolchain`. This toolchain requires an
725-
execution platform to match all the constraints of the test rule's target
726-
platform. In particular, the target platform is compatible with this toolchain
720+
execution platform to match all of the test rule's target platform
721+
constraints.
722+
723+
In particular, the target platform is compatible with this toolchain
727724
if it is also registered as an execution platform. If no such platform is
728-
found, the test rule fails with a toolchain resolution error.
725+
found, the test rule fails with a toolchain resolution error
726+
* If `--@bazel_tools//tools/test:incompatible_use_default_test_toolchain` is
727+
disabled, the active test toolchain is
728+
`@bazel_tools//tools/test:legacy_test_toolchain`. This toolchain does not
729+
impose any constraints and thus test actions without manually specified exec
730+
constraints are configured for the first registered execution platform.
731+
732+
This is often not the intended behavior in multi-platform builds as it can
733+
result in, for example, a test binary built for Linux on a Windows machine to
734+
be executed on Windows.
735+
736+
As a legacy setting, expect this option to be unavailable in a future Bazel
737+
release.
729738

730739
Users can register additional toolchains for this type to influence this
731740
behavior and their toolchains will take precedence over the default ones.
@@ -734,8 +743,10 @@ a default toolchain for it.
734743

735744
## Tag conventions {:#tag-conventions}
736745

737-
Some tags in the test rules have a special meaning. See also the
738-
[Bazel Build Encyclopedia on the `tags` attribute](/reference/be/common-definitions#common.tags).
746+
Some tags in the test rules have a special meaning.
747+
See also the
748+
[Bazel Build Encyclopedia on the `tags` attribute]
749+
(/reference/be/common-definitions#common.tags).
739750

740751
<table>
741752
<tr>

0 commit comments

Comments
 (0)