bazelbuild/bazel

Default value for `instrumentation_filter` will change when using on instrumentation test targets

Open

#14.652 geöffnet am 27. Jan. 2022

Auf GitHub ansehen
 (2 Kommentare) (1 Reaktion) (0 zugewiesene Personen)Java (4.465 Forks)batch import
P3coveragehelp wantedteam-Documentationteam-Rules-Servertype: documentation (cleanup)

Repository-Metriken

Stars
 (25.384 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 22T 20h) (77 gemergte PRs in 30 T)

Beschreibung

Description of the problem / feature request:

The behavior of instrumentation_filter doesn't match the documentation's description: default: "-/javatests[/:],-/test/java[/:]"

For example, here is the result of offline instrumentation test result of different commands with options:

bazel coverage app → offline instrumentation works
bazel coverage app //unit-test-target → only unit test lib got offline instrumentation
bazel coverage app-instrumentation-test → offline instrumentation doesn't work
bazel build app-instrumentation-test --collect_code_coverage  → offline instrumentation works
bazel coverage app-instrumentation-test --collect_code_coverage  → offline instrumentation doesn't work

As you can see, the behavior is very inconsistent and the root cause is that the default value of instrumentation_filter will be changed to match the target itself when we run test command on an instrumentation test target, meaning none of the dependency will got instrumented.

Example, say //app depends on //battery, when we run bazel coverage app-instrumentation-test, the default instrumentation_filter for //battery will be "-/battery[/:]" and the same applies to all other libraries

Expected behavior

Either update the documentation, or keep default value of instrumentation_filter unchanged everywhere.

Contributor Guide