mozilla / grcov

Rust tool to collect and aggregate code coverage data for multiple source files
Mozilla Public License 2.0
1.17k stars 148 forks source link

Example for C++ coverage processing with different folders for source/notes and coverage data files? #1072

Open aallrd opened 1 year ago

aallrd commented 1 year ago

Hello,

I am trying to use grcov to process coverage information of a C++ application on a runtime server.

$ ./grcov --version
grcov 0.8.18
$ gcov --version
gcov (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)

When executing the application, the folder COVERAGE/<PID> is created containing the gcda files:

COVERAGE/<PID>/output/lib/awesome/o/awesome/file.gcda

I have a SOURCES folder that contains the source code of the application and the associated gcno files:

SOURCES/
  lib/awesome/file.cpp
  output/lib/awesome/o/awesome/file.gcno

I don't know how to call grcov with this setup, I have tried the below command but it fails:

$ ./grcov \
  --output-types lcov \
  --output-path grcov.lcov.info \
  --source-dir SOURCES \
  COVERAGE/<PID>/
[ERROR] A panic occurred at src/producer.rs:544: No input files found

Do you know if this is possible?

Thank you.

marco-c commented 1 year ago

Where are the .gcno files stored? You need to pass both gcda and gcno.