Skip to content
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

--incompatible_bazel_test_exec_run_under #23179

Open
1 of 4 tasks
gregestren opened this issue Jul 31, 2024 · 0 comments
Open
1 of 4 tasks

--incompatible_bazel_test_exec_run_under #23179

gregestren opened this issue Jul 31, 2024 · 0 comments
Labels
incompatible-change Incompatible/breaking change P2 We'll consider working on this in future. (Assignee optional) team-Configurability platforms, toolchains, cquery, select(), config transitions

Comments

@gregestren
Copy link
Contributor

gregestren commented Jul 31, 2024

Motivation

$ bazel test //:mytest --run_under=//:runner will call //:runner on an exec machine.

Bazel currently configures it for the target platform, which is incorrect.

Description

With this flag, //:runner is configured for the exec platform, where it actually runs.

Incompatible Flag

--incompatible_bazel_test_exec_run_under

Migration Guide

  1. If you have a $ bazel test //:mytest --run_under=//:runner command, add --incompatible_bazel_test_exec_run_under.

If this fails, that means //:runner configures itself with target config information. This might be:

  • reads target platform properties from --platforms
  • reads --define or --//foo flags that don't propagate from the target to exec config
  • has a select() on any of the above.

Since //:runner is an execution tool, refactor it so it doesn't have target config dependencies. This may require moving target-configured deps (like some data binary) to //:mytest and having the test reference them from there.

In which Bazel LTS version will this incompatible change be enabled?

Bazel 8

Additional Context

Motivatin: #22624

TODO List

  • Implement the incompatible change at Bazel HEAD and guard it behind a flag.
  • Test the incompatible change with downstream projects and inform broken projects.
  • Flip the incompatible flag at Bazel HEAD.
  • Delete the incompatible flag and the old behavior at Bazel HEAD.
@gregestren gregestren added untriaged incompatible-change Incompatible/breaking change labels Jul 31, 2024
@gregestren gregestren added team-Configurability platforms, toolchains, cquery, select(), config transitions P2 We'll consider working on this in future. (Assignee optional) and removed untriaged labels Jul 31, 2024
copybara-service bot pushed a commit that referenced this issue Aug 1, 2024
b03e4c5  is an incompatible change. Repo testing showed failures changing this
unconditionally. So adding `--incompatible_bazel_test_exec_run_under` to gate it.

Even though `$ bazel test --run_under=//foo` invokes `//foo` on exec machines, `//foo`'s build may still expect target configurations. For example:

 - custom toolchain settings
 - target-focused `select()`s
 - user-defined flags that don't propagate to the exec config

See #23179.

PiperOrigin-RevId: 658472773
Change-Id: I1bdf30432a6e3c74fc0355f1a96fee44ba2d453a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incompatible-change Incompatible/breaking change P2 We'll consider working on this in future. (Assignee optional) team-Configurability platforms, toolchains, cquery, select(), config transitions
Projects
None yet
Development

No branches or pull requests

4 participants