Discrepancy between `lcov` and CodeCov reported coverage

Description

lcov coverage reported in CI log differs from coverage reported by CodeCov.

CI/CD URL

Codecov Output

2022-05-24T22:28:39.0833075Z ##[group]Run codecov/codecov-action@v2
2022-05-24T22:28:39.0833604Z with:
2022-05-24T22:28:39.0833855Z   flags: c_cpp
2022-05-24T22:28:39.0834103Z env:
2022-05-24T22:28:39.0834449Z   DEVCONTAINER_IMAGE: ghcr.io/magma/magma/devcontainer:latestv2
2022-05-24T22:28:39.0834857Z   BAZEL_BASE_IMAGE: ghcr.io/magma/magma/bazel-base:latestv2
2022-05-24T22:28:39.0835202Z   BAZEL_CACHE: bazel-cache
2022-05-24T22:28:39.0835519Z   BAZEL_CACHE_REPO: bazel-cache-repo
2022-05-24T22:28:39.0835861Z   MAGMA_ROOT: /home/runner/work/magma/magma
2022-05-24T22:28:39.0836169Z   BRANCH: master
2022-05-24T22:28:39.0836492Z   REVISION: 0672dd4a139090aa51e4ed40e8d4f3a5c7fbdb52
2022-05-24T22:28:39.0836810Z ##[endgroup]
2022-05-24T22:28:39.2976434Z ==> linux OS detected
2022-05-24T22:28:39.8321988Z https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
2022-05-24T22:28:39.9282623Z ==> SHASUM file signed by key id 806bb28aed779869
2022-05-24T22:28:40.1320361Z ==> Uploader SHASUM verified (648b599397548e4bb92429eec6391374c2cbb0edb835e3b3f03d4281c011f401  codecov)
2022-05-24T22:28:40.1322339Z ==> Running version latest
2022-05-24T22:28:40.1967952Z ==> Running version v0.2.3
2022-05-24T22:28:40.1992169Z [command]/home/runner/work/_actions/codecov/codecov-action/v2/dist/codecov -n  -Q github-action-2.1.0 -F c_cpp -C 0984abaf8487ae2a040814e3efefc59b65be2ad2
2022-05-24T22:28:40.4285734Z [2022-05-24T22:28:40.426Z] ['info'] 
2022-05-24T22:28:40.4286910Z      _____          _
2022-05-24T22:28:40.4287740Z     / ____|        | |
2022-05-24T22:28:40.4289532Z    | |     ___   __| | ___  ___ _____   __
2022-05-24T22:28:40.4290302Z    | |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
2022-05-24T22:28:40.4291068Z    | |___| (_) | (_| |  __/ (_| (_) \ V /
2022-05-24T22:28:40.4314360Z     \_____\___/ \__,_|\___|\___\___/ \_/
2022-05-24T22:28:40.4315207Z 
2022-05-24T22:28:40.4315637Z   Codecov report uploader 0.2.3
2022-05-24T22:28:40.4500455Z [2022-05-24T22:28:40.449Z] ['info'] => Project root located at: /home/runner/work/magma/magma
2022-05-24T22:28:40.4555315Z [2022-05-24T22:28:40.455Z] ['info'] -> No token specified or token is empty
2022-05-24T22:28:40.4839927Z [2022-05-24T22:28:40.483Z] ['info'] Searching for coverage files...
2022-05-24T22:28:41.7772425Z [2022-05-24T22:28:41.776Z] ['info'] Warning: Some files located via search were excluded from upload.
2022-05-24T22:28:41.7773964Z [2022-05-24T22:28:41.776Z] ['info'] If Codecov did not locate your files, please review https://docs.codecov.com/docs/supported-report-formats
2022-05-24T22:28:41.7774946Z [2022-05-24T22:28:41.776Z] ['info'] => Found 3 possible coverage files:
2022-05-24T22:28:41.7775715Z   _coverage_report.dat
2022-05-24T22:28:41.7776445Z   coverage.info
2022-05-24T22:28:41.7776809Z   build/c/coverage.info
2022-05-24T22:28:41.7777496Z [2022-05-24T22:28:41.777Z] ['info'] Processing /home/runner/work/magma/magma/_coverage_report.dat...
2022-05-24T22:28:41.7805333Z [2022-05-24T22:28:41.780Z] ['info'] Processing /home/runner/work/magma/magma/coverage.info...
2022-05-24T22:28:41.8458569Z [2022-05-24T22:28:41.845Z] ['info'] Processing /home/runner/work/magma/magma/build/c/coverage.info...
2022-05-24T22:28:42.7777994Z [2022-05-24T22:28:42.777Z] ['info'] Detected GitHub Actions as the CI provider.
2022-05-24T22:28:42.7863143Z [2022-05-24T22:28:42.785Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=github-action-2.1.0-uploader-0.2.3&token=*******&branch=maxhbr%2FdropFacebookincubatorReferences&build=2380747907&build_url=https%3A%2F%2Fgithub.com%2Fmagma%2Fmagma%2Factions%2Fruns%2F2380747907&commit=0984abaf8487ae2a040814e3efefc59b65be2ad2&job=agw-workflow&pr=12835&service=github-actions&slug=magma%2Fmagma&name=&tag=&flags=c_cpp&parent=
2022-05-24T22:28:43.3356168Z [2022-05-24T22:28:43.335Z] ['info'] https://codecov.io/github/magma/magma/commit/0984abaf8487ae2a040814e3efefc59b65be2ad2
2022-05-24T22:28:43.3360300Z https://storage.googleapis.com/codecov/v4/raw/2022-05-24/24CD499F226006DDCC8C213D9F134932/0984abaf8487ae2a040814e3efefc59b65be2ad2/344438a9-4c8e-4512-a6bf-fed82a6bbab1.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=GOOG1EKKHVKCKHW7KBCGM7IHR55T63V2PAVJWLVFNITJHDU5G6R5IRN3LMWJA%2F20220524%2FUS%2Fs3%2Faws4_request&X-Amz-Date=20220524T222843Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=afdf8bbe408eb55910e229d1a18b9dd81fd89791f1fd602ae483332022034212
2022-05-24T22:28:43.3365922Z [2022-05-24T22:28:43.335Z] ['info'] Uploading...
2022-05-24T22:28:43.6479063Z [2022-05-24T22:28:43.646Z] ['info'] {"status":"success","resultURL":"https://codecov.io/github/magma/magma/commit/0984abaf8487ae2a040814e3efefc59b65be2ad2"}

Expected Results

Expected lcov results

2022-05-24T22:27:02.9342441Z Combining tracefiles.
2022-05-24T22:27:02.9343183Z Reading tracefile /tmp/coverage_initialize.info
2022-05-24T22:27:02.9343847Z Reading tracefile /tmp/coverage_oai.info
2022-05-24T22:27:02.9344510Z Writing data to /workspaces/magma/build/c/coverage.info
2022-05-24T22:27:02.9345101Z Summary coverage rate:
2022-05-24T22:27:02.9345617Z   lines......: 16.4% (74321 of 453548 lines)
2022-05-24T22:27:02.9346183Z   functions..: 17.2% (12845 of 74786 functions)
2022-05-24T22:27:02.9346721Z   branches...: no data found

to match CodeCov results Code coverage done right..

Actual Results

lcov results differ significantly from CodeCov results. In particular the total number of lines of code relative to which the coverage is computed differ by almost 300K lines.

Additional Information

This could be a path issue perhaps. For example, looking at 'magma/lte/gateway/c/core/oai/lib/directoryd on CodeCov:


but lcov HTML report contains directoryd twice, once in /home/vagrant/build/c/core/oai/lib/directoryd/orc8r/protos and again under lib/directoryd. Only the files in the second directory are reported on CodeCov. I believe the files in the first path are auto-generated but i don’t see why this should make a difference.

Here is what the results look like for lcov

@danielgenin what happens if you the Codecov action with

functionalities: network