Comments (3)
If I understand your environment: I think that we do exactly this, successfully. (Build coverage-instrumented shared library, use that library in a bunch of executables - generate unified coverage report across all the executables and all the tests.)
Maybe try to walk before you run:
- does your data build successfully/what happens when you do not use
GCOV_PREFIX
?
Why do you think you needGCOV_PREFIX
(there are valid reasons to use it - just wondering if your case is one of them). - does a very simple project (say, one source file in each of two directories) do what you expect when you do use
GCOV_PREFIX
?
I guess you know that the runtime coverage data (the .gcda files) are generated only after running your executable - and only if it exits normally. Is the code missing from your data actually used/linked in your test executable? Did your tests run?
You did not mention platform or tool versions.
You are more likely to get a useful answer if you provide a small testcase that exhibits the issue you are seeing.
from lcov.
Thank you for your reply.
- My data build successfully.
- The result is the same when I don't use GCOV-PREFIX and when I use GCOV-PREFIX, gcda will be generated in the /data/ because I have set fpprofile-dir=/data/ in both the bp and mk files, and set export GCOV_PREFIX=/data/ to be more secure.
- one source file in each of two directories, when I use GCOV_PREFIX=/data/, the gcda files are generated under /data/, such as /data/name1/test/dir1/test1.gcda, /data/name1/test/dir2/test2.gcda
But there is no corresponding /data/source.cpp for /data/source.gcda, I confirm that both test1.cpp and test2.cpp have called functions in source. cpp.
from lcov.
I guess you realize that this is a compiler/toolchain issue - not an lcov issue.
You may get better results by asking your question in a clang/llvm group.
You will also get better results if you include a small testcase - or even a large testcase - which illustrates the issue you are seeing.
Ideally, such a testcase would include a small handful of source files and a makefile or shellscript which builds your example application, runs your tests, and then indicates which data is missing.
Without such an example, it is impossible to know what you did - maybe there is a problem in your setup, you used wrong parameters - and impossible to know what happened.
I do not know how -fprofile-dir
and GCOV_PREFIX
interact. We use one or the other - not both (the former to use the 'llvm profile' coverage data flow, and the latter to use the 'gcov data' coverage flow).
I suggest to start with a small example and build up slowly until you see an error that looks like what you see with your actual application - then you can either debug the issue, or include the example when asking for help. One possible "building up" sequence is:
- two source directories 'srs
and
lib`, one source file in each. - build all the
.o
and explicitly link them - say, with--coverage
(gcov flow) and with-fprofile-instr-generate -fcoverage-mapping
(profdata flow).i
Does coverage data get generated as you expected (say, with and without GCOV_PREFIX, with and without profile redirection)? - archive the .o from the
lib
directory into a static library (ar -o libstatic.a ...
) - then link that with the .o from thesrc
directory and run the experiments again.
Did coverage data get generated as you expected? - link the .o from the
lib
directory into a shared library - then link that with your .o, and see if coverage data gets generated as you expected.
Gradually make your small testcase look more and more like your actual application as you try to make your testcase fail.
If the above sounds like too much work and too much schedule uncertainty: consider hiring a consultant who is expert in this field.
from lcov.
Related Issues (20)
- geninfo settings don't work in config files in v2.1-beta1 or v2.1-beta2 HOT 3
- test_differential in the example now gives error HOT 1
- genhtml is too slow compared to old version HOT 10
- genhtml: --keep-going doesn't work for ERROR: <file> is not readable or doesn't exist. HOT 8
- how to see the verbose error msg? HOT 11
- LCOV 2.1 not compatible with Codecov HOT 9
- LCOV coverage.dat file has "DA:0:0" HOT 3
- lcov on x86 HOT 9
- genhtml: ERROR: Can't call method "branchElem" on an undefined value HOT 2
- Duplicate folder structure (--prefix does not help) HOT 2
- gcov error:std::bad_alloc HOT 7
- lcov fails with gcc 14 HOT 1
- perl2lcov: unexpected data type 'time' HOT 6
- genhtml package removed from PyPI HOT 1
- RPM 2.1-1 does not install on Rocky Linux 8 or Centos7 HOT 1
- inconsistent branch coverage summary HOT 1
- Build of example fails on Ubuntu 22.04.4 LTS due to Makefile using SHELL of /bin/sh (softlink to /bin/dash)
- Build of examples fails if part of path is a softlink HOT 3
- Option geninfo_external from a user-provided lcovrc file gets ignored HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lcov.