Skip to content

collect_cc_coverage.sh incorrectly assumes llvm-cov generates gcov.json files #18874

@carlosgalvezp

Description

@carlosgalvezp

Description of the bug:

Hi,

We are trying to migrate from our working GCC gcov solution for coverage in Bazel, to Clang-based coverage. Note: I do not mean "source-based code coverage" (which I believe only has experimental support in Bazel). I mean using the --coverage flag when building with Clang, which should produce identical results as GCC. In other words, using clang as a drop-in replacement for GCC.

Currently computing coverage fails because Bazel expects *.gcov.json files and it cannot find them:

mv: cannot stat '*.gcov.json.gz': No such file or directory

This comes from this line:
https://github.com/bazelbuild/bazel/blob/master/tools/test/collect_cc_coverage.sh#L163

So even though GCC 9+ does generate .gcov.json files, Clang 9+ does not do so.

I am using the following relevant flags and settings:

coverage --instrument_test_targets
coverage --combined_report=lcov
        tool_path(
            name = "gcov",
            path = "wrapper/llvm-cov",
        ),

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

No response

Which operating system are you running Bazel on?

Ubuntu 20.04

What is the output of bazel info release?

release 6.1.0

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 master; git rev-parse HEAD ?

No response

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions