Skip to content

Compiled doctest runners use the compiler execution platform instead of the test platform #4293

Description

@jrandolf

Description

rust_doc_test builds its compiled-doctest runner through _test_runner_bin with cfg = "exec". That selects the default execution configuration used for compiler tools. If compilation and testing use different platforms, the generated test launcher can point to a runner built for the compiler worker instead of the test worker.

The compiled launcher also declares its output with just the target name, which drops the runner's .exe suffix on Windows.

The runner should use Bazel's test execution group and retain its executable suffix. Legacy doctests execute their compiler during the test, so a compiler/target triple mismatch should produce an analysis diagnostic explaining the nightly compiled-doctest requirement.

Reproduction steps

The platform regression in #4279 registers macOS arm64 and x86_64 execution platforms, targets x86_64, and inspects the runner artifact chosen for a compiled doctest. It expects the runner to come from the x86_64 test configuration; the old transition selects the default compiler execution configuration.

On macOS arm64, the PR's regression can be run with:

bazel test --config=nightly \
  --//rust/settings:experimental_compile_rustdoc_tests=true \
  //test/unit/rustdoc:compiled_runner_platform_test \
  //test/unit/rustdoc:compiled_runner_test \
  //test/unit/rustdoc:legacy_cross_build_test

The platform case inspects actions without executing a foreign binary. The suffix case compares the launcher and runner extensions. The legacy case expects an analysis-time explanation instead of constructing a test that would execute the cross compiler on the target worker.

Additional context

Proposed fix: #4279. Use config.exec("test") for the runner, preserve .exe, and reject the unsupported legacy cross-build path. The platform regression requires Bazel's default test-toolchain support; Windows runtime execution remains for CI.

Impact

Compiled doctests cannot reliably separate compiler workers from native test workers, and Windows launchers lose the executable suffix.

Bazel and rules_rust version

Affected rules_rust revision: c708b236. The existing regression work used Bazel 9.2.0 on macOS arm64.
The platform regression uses analysis on macOS arm64; it does not establish Windows or Linux runtime behavior.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions