No coverage data if testing code from external repositories
See original GitHub issueDescription of the bug:
Using software and tests in the same repository is no problem, coverage data are produced. Splitting the two makes problems. There is “no coverage data” produced anymore. It seems that coverage data is generated, but not consumed, maybe because of some path issue/mismatch. If I also instrument the tests, the test’s coverage will be copied into the combined coverage file, but still no software coverage.
What’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Minimal example in this test repo. This will use this software repo and produce no coverage.
Simply check it out and run
bazel coverage -c dbg --combined_report=lcov --instrumentation_filter="@sw_repo//:funclib" --action_env=COVERAGE_GCOV_OPTIONS=-b //:mytest
This will say WARNING: There was no coverage found.
Which operating system are you running Bazel on?
Debian (WSL2)
What is the output of bazel info release
?
release 5.3.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
Have you found anything relevant by searching the web?
I did not find anything searching.
In this Slack discussion I was encouraged to create an issue.
Any other information, logs, or outputs that you want to share?
I can see in the testlog that coverage info is build. Then it is processed but no data is found.
Executing tests from //:mytest
-----------------------------------------------------------------------------
File 'test/test.c'
Lines executed:83.33% of 6
Branches executed:100.00% of 2
Taken at least once:50.00% of 2
Calls executed:50.00% of 2
Creating 'test.pic.gcov.json.gz'
Lines executed:83.33% of 6
File 'external/sw_repo/sw/func.c'
Lines executed:53.85% of 13
Branches executed:100.00% of 3
Taken at least once:33.33% of 3
No calls
Creating 'func.pic.gcov.json.gz'
Lines executed:53.85% of 13
Sep 02, 2022 7:49:56 PM com.google.devtools.coverageoutputgenerator.Main getTracefiles
INFO: No lcov file found.
Sep 02, 2022 7:49:56 PM com.google.devtools.coverageoutputgenerator.Main getGcovInfoFiles
INFO: No gcov info file found.
Sep 02, 2022 7:49:56 PM com.google.devtools.coverageoutputgenerator.Main getGcovJsonInfoFiles
INFO: Found 2 gcov json files.
Sep 02, 2022 7:49:56 PM com.google.devtools.coverageoutputgenerator.Main parseFilesSequentially
INFO: Parsing file /home/lukas/.cache/bazel/_bazel_lukas/7da12e39a3158a3f59d65f10c3647c59/sandbox/linux-sandbox/13/execroot/test_repo/_coverage/mytest/test/test.pic.gcov.json.gz
Sep 02, 2022 7:49:56 PM com.google.devtools.coverageoutputgenerator.Main parseFilesSequentially
INFO: Parsing file /home/lukas/.cache/bazel/_bazel_lukas/7da12e39a3158a3f59d65f10c3647c59/sandbox/linux-sandbox/13/execroot/test_repo/_coverage/mytest/test/func.pic.gcov.json.gz
Sep 02, 2022 7:49:56 PM com.google.devtools.coverageoutputgenerator.Main getProfdataFileOrNull
INFO: No .profdata file found.
Sep 02, 2022 7:49:56 PM com.google.devtools.coverageoutputgenerator.Main runWithArgs
WARNING: There was no coverage found.
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:10 (4 by maintainers)
Top GitHub Comments
We’re rolling #16637 back since it’s breaking some internal tests 😦 Reopening to keep track of it again.
@celkas That’s always going to be a problem as external repositories aren’t materialized in your workspace, they only exist under the Bazel output base. Does genhtml let you specify additional source roots? If so, you could use that instead of the symlink. If there isn’t, some
sed
or the symlink is going to be your best bet.