bazelbuild / bazelbuild/bazel

Support input for `--instrumentation_filter` in the form of a file

Open
#26,353 1 comment 0 reactions 0 assignees View on GitHub
coverage P2 team-Local-Exec type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the feature request:

Please support an alternative way to input very large values for `--instrumentation_filter` when running `bazel coverage` commands. Perhaps something like `--instrumentation_filter_file`.

The context here is that I work in a large monorepo. In our CI testing we invoke Bazel once to calculate test and coverage status for all necessary targets. A part of this means determining which projects need to have coverage calculated and enabling instrumentation for these projects via the `--instrumentation_filter`. An issue we have seen is when most or all of our projects need to calculate coverage, we hit issues passing the very large instrumentation filter over the command line.

It seems like a similar problem to what `--target_pattern_file` was designed to solve for.

### Which category does this issue belong to?

Configurability

### What underlying problem are you trying to solve with this feature?

Trying to set `--instrumentation_filter` to a value larger than 130KB causes Bazel to fail. Usually due to hitting some ARGMAX limit (seen as `Argument list too long`). The issue isn't really Bazel's fault, and I'm pretty sure it depends on the OS & machine running this. But it seems reasonable to have a more consistent solution to this that circumvents the issue all together.

### Which operating system are you running Bazel on?

linux

### What is the output of `bazel info release`?

7.6.1

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

_No response_

### What's the output of `git remote get-url origin; git rev-parse HEAD` ?

```text

```

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by comparing how --target_pattern_file is handled with the existing --instrumentation_filter option used by bazel coverage. Trace the coverage command's option parsing and identify where an input file could be accepted. Done means large instrumentation filter values work without command-line length limits and coverage behavior remains correct, with tests covering the file-based input.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, cli, testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.