Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bazel coverage not working on java_tests #13178

Closed
ThomasCJY opened this issue Mar 8, 2021 · 5 comments
Closed

Bazel coverage not working on java_tests #13178

ThomasCJY opened this issue Mar 8, 2021 · 5 comments
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-Java Issues for Java rules type: bug

Comments

@ThomasCJY
Copy link
Contributor

Description of the problem / feature request:

bazel coverage will generate empty report of coverage_report.dat file and the test coverage feature is not working correctly.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

I created a test repository and it can be easily reproduced by running bazel coverage command

What operating system are you running Bazel on?

Linux Ubuntu 20.04

What's the output of bazel info release?

release 4.0.0

Have you found anything relevant by searching the web?

no

@nkoroste
Copy link
Contributor

nkoroste commented Mar 9, 2021

could be related to: #5426

@aiuto aiuto added team-Rules-Java Issues for Java rules untriaged labels Mar 31, 2021
@ulfjack
Copy link
Contributor

ulfjack commented Apr 19, 2021

The problem is that Bazel uses an automatically computed default for --instrumentation_filter, which is

INFO: Using default value for --instrumentation_filter: "^//src/main/java/com/example/unit[/:]".

However, the JavaUtil.java file is in src/main/java/com/example/JavaUtil.java and therefore doesn't match the filter.

@comius
Copy link
Contributor

comius commented May 5, 2021

@c-mita can you triage this?

@c-mita c-mita added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels May 11, 2021
Copy link

github-actions bot commented Feb 7, 2024

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Feb 7, 2024
@c-mita
Copy link
Member

c-mita commented Feb 21, 2024

As pointed out, the issue appeared to be the inappropriate instrumentation filter.

@c-mita c-mita closed this as completed Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-Java Issues for Java rules type: bug
Projects
None yet
Development

No branches or pull requests

7 participants