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

LcovParser does not follow spec for FN: line #25118

Closed
alexeagle opened this issue Jan 29, 2025 · 0 comments
Closed

LcovParser does not follow spec for FN: line #25118

alexeagle opened this issue Jan 29, 2025 · 0 comments
Labels
team-Core Skyframe, bazel query, BEP, options parsing, bazelrc type: bug untriaged

Comments

@alexeagle
Copy link
Contributor

Description of the bug:

Bazel's coverage data handling follows the LCOV specification, which defines a descriptor of a function with FN. You can find with man geninfo or in the hosted manpage

                     FN:<line number of function start>,[<line number of function end>,]<function
                     name>

              The 'end' line number is optional, and is generated only if the compiler/toolchain
              version is recent enough to generate the data

However Bazel's implementation in LcovParser.java does not permit the 'end line number'. It's grammar is

FN:<line number of function start>,<function name>

As a result, coverage gathered with a tool like coverage.py cannot be parsed by Bazel.

Which category does this issue belong to?

Core

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

see https://github.com/aspect-build/rules_py/actions/runs/13018843537/job/36314576810 which has a very simple usage of coverage

During bazel coverage we see a warning:

Jan 28, 2025 8:20:41 PM com.google.devtools.coverageoutputgenerator.LcovParser parseFNLine
WARNING: Tracefile contains invalid FN line FN:1,2,welcome

this produces a corrupted file that lcov and genhtml cannot read, since a dangling reference to the missing function ends up in the merged lcov data:

genhtml: ERROR: unknown function 'welcome'
	(use "genhtml --ignore-errors mismatch ..." to bypass this error)

Which operating system are you running Bazel on?

macos or linux

What is the output of bazel info release?

7.4.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 ?


If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

No response

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

No response

@sgowroji sgowroji added the team-Core Skyframe, bazel query, BEP, options parsing, bazelrc label Jan 29, 2025
alexeagle added a commit to aspect-build/rules_py that referenced this issue Jan 29, 2025
bazelbuild/bazel#25118 was causing our
coverage reports to fail to parse into combined report.

Related to #520 which was missing testing that the report actually
worked.
fyi @dizzy57
c-mita added a commit to c-mita/bazel that referenced this issue Feb 5, 2025
Built at commit ee12906

Relevant changes:

    * Add support for input FN lines that include a function end line
      (bazelbuild#25118)

RELNOTES:
    LCOV parsing does not break on FN lines including an end line number
copybara-service bot pushed a commit that referenced this issue Feb 5, 2025
Built at commit ee12906

Relevant changes:

 * Add support for input FN lines that include a function end line (#25118).

RELNOTES:
    LCOV parsing does not break on FN lines including an end line number.

Closes #25200.

PiperOrigin-RevId: 723451534
Change-Id: I8912082ae6517bf0359329004d9a4f5e9ac76188
bazel-io pushed a commit to bazel-io/bazel that referenced this issue Feb 5, 2025
Built at commit ee12906

Relevant changes:

 * Add support for input FN lines that include a function end line (bazelbuild#25118).

RELNOTES:
    LCOV parsing does not break on FN lines including an end line number.

Closes bazelbuild#25200.

PiperOrigin-RevId: 723451534
Change-Id: I8912082ae6517bf0359329004d9a4f5e9ac76188
github-merge-queue bot pushed a commit that referenced this issue Feb 5, 2025
Built at commit ee12906

Relevant changes:

* Add support for input FN lines that include a function end line
(#25118).

RELNOTES:
LCOV parsing does not break on FN lines including an end line number.

Closes #25200.

PiperOrigin-RevId: 723451534
Change-Id: I8912082ae6517bf0359329004d9a4f5e9ac76188

Commit
df92905

Co-authored-by: Charles Mita <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Core Skyframe, bazel query, BEP, options parsing, bazelrc type: bug untriaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants