-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --@bazel_tools//tools/test:incompatible_use_default_test_toolchain
#25123
base: master
Are you sure you want to change the base?
Conversation
69512ad
to
8e3a78e
Compare
--@bazel_tools//tools/test:incompatible_use_default_test_toolchain
Why a starlark flag and not a native flag? Starlark flags under |
I am ultimately open to both, but I saw most benefits on the side of a Starlark flag:
|
a3bed45
to
e46820d
Compare
Hmm, I missed the part where this isn't used in the Bazel binary, and so we can entirely skip it for internal blaze. Adding this to my review queue, it's going to need some in-depth thinking. |
e46820d
to
5322be9
Compare
I resolved the conflict and am now making use of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay: a few comments but overall this looks reasonable.
@@ -332,16 +332,6 @@ public static class TestOptions extends FragmentOptions { | |||
help = "If true, undeclared test outputs will be archived in a zip file.") | |||
public boolean zipUndeclaredTestOutputs; | |||
|
|||
@Option( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this moving to CoreOptions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment.
@@ -62,4 +62,8 @@ public class LabelConstants { | |||
// As a result, external repository runfiles are symlinked to: | |||
// $runfiles_root/$workspace_name/../$repo_name/<path>, i.e. $runfiles_root/$repo_name/<path>. | |||
public static final PathFragment EXTERNAL_RUNFILES_PATH_PREFIX = PathFragment.create(".."); | |||
|
|||
// The label of the toolchain type to add to the default "test" exec group. | |||
public static final Label DEFAULT_TEST_TOOLCHAIN_TYPE = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Despite the name of the class, everything else in LabelConstants
is a PathFragment
.
Can this instead be in PlatformConstants
(which I just submitted a minute ago): I can't decide if it's better logically but it will greatly simplify my job to import this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved it and updated the other constant to be a Label
.
@@ -13,7 +13,6 @@ filegroup( | |||
"//src/test/java/com/google/devtools/build/lib/bazel/rules/genrule:srcs", | |||
"//src/test/java/com/google/devtools/build/lib/bazel/rules/java:srcs", | |||
"//src/test/java/com/google/devtools/build/lib/bazel/rules/python:srcs", | |||
"//src/test/java/com/google/devtools/build/lib/bazel/rules/sh:srcs", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the removal of the sh tests actually part of this change, or just a drive-by? Can it be a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That separate PR is #25142, but it hasn't been merged yet. When it has landed, I can rebase this.
f030b3b
to
257f068
Compare
Now that #25142 is merged, let me know when you've rebased and I will re-review. |
5343690
to
214e062
Compare
@katre Done, PTAL |
src/main/java/com/google/devtools/build/lib/analysis/config/CoreOptions.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/analysis/platform/DeclaredToolchainInfo.java
Show resolved
Hide resolved
@@ -305,6 +305,90 @@ def _impl(ctx): | |||
config.create( | |||
"embedded_tools/tools/test/BUILD", | |||
""" | |||
load(":default_test_toolchain.bzl", "bool_flag", "empty_toolchain") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is directly copied from tools/test/BUILD.tools, correct? Can we:
- Add that as a comment
- Simplify this (definitely by removing comments, possibly by removing targets)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, looking at this further, isn't the minimum the definition of the toolchain type? Do we need the toolchain definition? Can we make it optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dropped the comments. The existing test suite together with the new tests actually exercise all the targets I added. I don't see a way to strip them down while still getting realistic coverage of e.g. --use_target_platform_for_tests
.
214e062
to
ff976b3
Compare
Work towards #25160
RELNOTES: The new
--@bazel_tools//tools/test:incompatible_use_default_test_toolchain
flag can be used to have test actions select an execution platform that has all the constraints provided by the target platform instead of always selecting the first available execution platform. This supersedes the--use_target_platform_for_tests
flag.