Coverage of external files


I’ve split my project across a few repos.
One repo for the core code, written in C/C++.
One repo with Python bindings in C++ and unit tests in Python.

I’m trying to set up meaningful coverage metrics for the second repo.

I add C++ coverage compile flags when building the Python extensions.
Once the extensions are compiled, running pytests generates *.gcov files for all associated C++ code.

I’m going to group the *.gcov into three categories:

  1. The C++ Python extension code.
  2. C++ code from the standard library (e.g. basic_string.h.gcov)
  3. C++ code from the first repo.

After the tests are run and the *.gcov files are generated, I run the following command

bash <(curl -s

which saves the first group of *.gcov files, since associated code files are present.

It discards the second and third group of *.gcov files, since code files are not present.

Looking inside the generated *.gcov files, they have the full code content along with line counts.

I would like to special case the third group and ingest some of the *.gcov files to get a more complete picture of my Python bindings and Python tests.

How can I enumerate *.gcov for to ingest?

Edit: For clarity, the files I want to reference are in git submodules.


Hi @alephzero, this is definitely an interesting question. The problem here is that Codecov needs to collect the list of files before sending them to our server during upload. I would recommend using the -R flag in the Codecov uploader to see if you can move the root here.

Let me know if this works for you.