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

JacocoLCOVFormatter returns null in the case of a file with an empty package name #10863

Closed
d-haxton opened this issue Feb 25, 2020 · 0 comments

Comments

@d-haxton
Copy link

d-haxton commented Feb 25, 2020

Description of the problem / feature request:

In code coverage, if you're passing in a list of sources using -paths-for-coverage.txt there is a bug where a file name with no package will incorrectly prepend a / to a fileName which already has that slash.

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

Currently, we concat the package name with a / and the sourceFileName here: https://github.com/bazelbuild/bazel/blob/master/src/java_tools/junitrunner/java/com/google/testing/coverage/JacocoLCOVFormatter.java#L107

The problem with that is if there is no package name we now have a fileName that begins with a /

So when we check to see if the fileName matches what's in our list, we end up with a fileName with two leading // here: https://github.com/bazelbuild/bazel/blob/master/src/java_tools/junitrunner/java/com/google/testing/coverage/JacocoLCOVFormatter.java#L74

What operating system are you running Bazel on?

n/a

What's the output of bazel info release?

release 2.0.0

luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
    This fixes: bazelbuild/bazel#10863

    Closes #10864.

    PiperOrigin-RevId: 297352463
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant