Skip to content

--incompatible_bazel_test_exec_run_under #23179

@gregestren

Description

@gregestren

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

Motivation: #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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2We'll consider working on this in future. (Assignee optional)incompatible-changeIncompatible/breaking changeteam-Configurabilityplatforms, toolchains, cquery, select(), config transitions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions