-
-
Notifications
You must be signed in to change notification settings - Fork 589
tests: make some analysis tests work for when test's exec platform is required #2869
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
base: main
Are you sure you want to change the base?
Conversation
@rickeylev @aignas I need help here. I am registering the test target platform as an execution platform to ensure compatibility with the new test toolchain, but that runs into an issue I'm planning to resolve in the future by bazelbuild/bazel#26019: every In this particular case, I could work around this by transitioning to the host platform rather than the fixed platform LINUX_X86_64. Would that be acceptable? |
The launcher_maker is only needed for windows, so that dependency shouldn't be occurring for linux et al. I see it's refering to @bazel_tools//tools/launcher:launcher_maker directly, though. IIRC, bazel_tools has a select() to point that to something no-op. So it shouldn't still be requiring a C++ toolchain? Would it help if we changed py_executable to point to an alias with select()?
py_executable has an optional dependency on the cc toolchain regardless, but I'm assuming that's OK. |
Yes, it's only needed for Windows, but with the current setup within Bazel, every OS pays the price (the exec dep on a C++ toolchain). The selects (both the one that exists in Bazel and the one you suggest) apply after the exec transition and thus can't distinguish between a build that targets Windows and a build that doesn't. That's why I'm planning to introduce a toolchain for the launcher maker, which can match on both exec and target platform simultaneously. However, this will require Bazel feature detection or a new BCR module for the launcher maker, so it won't help here (at least not soon). |
I think I follow, I think 🙃 Transitioning to the host platform is probably ok. |
I now realized that this wouldn't work on Windows hosts. What do you think of registering a fake C++ toolchain? I've done that on other analysis tests and it did work there. |
Sgtm. There are a couple fake cc tool chains in tests/support/cc_toolchain that might just work already |
I updated the title and description to better reflect the what/why -- can you please confirm/correct? CI is passing after your recent change, so I think this is otherwise ready? After the title/description is confirmed, we can queue to merge. |
Does this PR mean that users using |
An upcoming change in Bazel makes the test toolchain required, which means a compatible
exec platform amongst toolchains must be found (bazelbuild/bazel@2780393).
Some analysis tests force the target platform to a specific platform, but the exec platform
was left alone. The combination of toolchains, target platform, and exec platform then
prevented a toolchain resolution from succeeding (the py rules depend on some cc targets,
which need the cc toolchain, which needs an exec platform).
To fix: Also explicitly set the exec platform and use a fake cc toolchain. This ensures a valid combination is used.
Work towards #2850