Skip to content

llvm-cov to expose exactly what lines it considers coveredΒ #126307

@vmiklos

Description

@vmiklos

Hi,

First, thanks for llvm-cov, it's a great tool -- Rust has 'cargo llvm-cov' that wraps llvm-cov for Rust code and it works nicely, almost.

One pain point is to figure out details when dealing with line coverage. We invoke 'llvm-cov export ... -format=text' to get the JSON output, and that does tell us if line coverage is complete or not (totals -> lines -> percent), and also this data is provided per-file (files -> ... -> summary -> lines -> percent). However, when percent is not 100, it would be useful to show which lines are not covered.

I understand that deciding if a line is covered or not is tricky, but I assume llvm-cov has this info at some stage, since it provides a percentage summary.

So the request would be to expose exactly which lines are not covered. At the moment 'cargo llvm-cov' tries to infer this from the current JSON output, but that's not perfect in all cases. When it works, it allows us to produce output like this:

Uncovered Lines:
src/test.rs: 15, 16

But for this to work, we need the code at https://github.com/taiki-e/cargo-llvm-cov/blob/09262deeaaabb18889ef265debc6c54600bd1d1a/src/json.rs#L208 to produce this, and feels like llvm-cov already has this info at some point, it's just thrown away.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions