Skip to content

cpp-coverage: bazel coverage builds filtered-out test targets (breaks consumers with Miri/Rust tests) #164

Closed

Description

@dcalavrezo-qorix

Problem

cpp-coverage.yml runs bazel coverage [flags] -- <targets> without --build_tests_only. Consumers typically pass --test_lang_filters=-rust,-miri via extra-bazel-flags, but test language filters only control which tests run — not what gets built. With wildcard targets (//score/...), Bazel still builds every test target, including filtered-out ones.

Observed breakage

eclipse-score/lifecycle#369 (bump to score_toolchains_rust 0.9.2): the C++ Coverage job fails with

error[E0463]: can't find crate for `profiler_builtins`

Chain: the job builds lifecycle's Miri test targets (execution filtered, build not) → the rules_rust fork's Miri support compiles their dependency subgraph against the Miri sysroot → since score_toolchains_rust 0.9.2, bazel coverage instruments Rust compiles (--codegen=instrument-coverage), which requires the profiler_builtins crate from the sysroot → the Miri sysroot artifact ships without the profiler runtime → compile error aborts the whole invocation, killing the in-flight C++ tests (NO STATUS).

Fix

Add --build_tests_only to the bazel coverage invocation in cpp-coverage.yml. With it, test filters apply to building as well, so filtered-out (Rust/Miri) tests are neither run nor built. This matches how the communication and persistency coverage setups invoke bazel coverage, and it is semantically right for a coverage job: only test targets and their dependencies matter for coverage.

Verified locally on lifecycle with the 0.9.2 bump: without the flag → E0463 build abort (16/19 tests, job red); with the flag → exit 0, 19/19 tests pass.

Related follow-ups (tracked elsewhere)

  • ferrocene_toolchain_builder: ship libprofiler_builtins in the miri-sysroot tarballs
  • rules_rust fork: suppress -Cinstrument-coverage for miri_enabled compiles (instrumenting interpreted-mode builds is meaningless)

Activity

  1. added a commit that references this issue on Jul 29, 2026
    4c20f0d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions