GCOV: GCDA files not generated when to many tests performed - gcov

Good morning,
I've got a problem when using GCOV within my working environment.
Gcov is working very well when I run some tests cases (up to 1000) but no gcda are generated when running more tests.
This is how I use it.
I compile my code with gcov flags correctly set
I boot a test server containing the gcov libs, and the variables GCOV_PREFIX and GCOV__PREFIX_STRIP
I launch my regression on this server
Once finished I stop the server and now all the gcda files are generated
use lcov and genhtml to generate the test coverage and the report.
This works very well when I've got few tests to lauch (up to 1000 cases I guess), but if I run more tests, I don't get any gcda files anymore...
I could not find any documentation on this part, is there a buffer somewhere, where all the gcdas files are stored waiting for the server to be released?
Is it possible to parameter this setting?
Is there any documentation on this subject somewhere?
Thanks a lot for your help.
Regards,
Thomas

Related

Gcov not generating.gcda files for few classes

I am using gcov to find code coverage of my application while running functional test cases.
Issue: .gcda files are not getting created for few classes though those classes are being executed
Steps:
Compile Application code with gcov and verify .gcno files are generated for all classes
Create binary image of compiled code and deploy server using that binary
Use cross profiling while deploying server. Home directory structure for my source code was "/proj/QQ/scm/tools/jenkins/db_ws/FunctionTestCoverage/ccode/" and I used below mentioned gcov parameters for cross profiling
GCOV_PREFIX=/automation/testCoverage
GCOV_PREFIX_STRIP=7
Run Functional Test Cases to hit application code
.gcda files gets created for few classes only. It is not getting created for all classes which are being executed.
.gcda files are generating under directory structure "/automation/testCoverage/ccode"
I believe this should not be issue with cross profiling. suppose I have 5 directories in parallel then .gcda files are generating for 2 directories only.
What can be root cause for my issue where .gcda are generating for only few files and how to resolve this?

GCOV: gcda files combination

Good afternoon,
I'd like to know if it could be possible to combine several gcda files without using the lcov -a tracefile1 -a tracefile2 -o output.html.
Actually this is my spec:
compile my code on local server
excute tests on remote server 1 and 2
{
then copy the generated gcda on server1 on the local compilation server and generate the info file thanks to lcov
then copy the generated gcda on server2 on the local compilation server and generate the info file thanks to lcov
then combine both info files
}
The info file generation is actually quite long and I'd like to know if there is a possibility to combine gcdas from servers 1 and 2 without creating the info file.
And generate the info file only for the resulting gcdas?
Gcov as of now does not have any functionality to merge coverage reports.
I have a setup similar to yours and I use lcov to merge the tracefiles(or .info files).You can write scripts that will transfer the .gcda files from remote servers back to your local machine to generate the coverage report. There are other tools available that can solve your problem like TestWellCTC++,Rapicover,etc but they are not open source.
Gcov as of now has functionality to merge coverage reports:
$ gcov-tool merge path1 path2
(by default results will be stored in merged_profile folder).
To add to another answer, gcov can also merge coverage data from multiple runs with the help of gcov-tool:
$ gcov-tool merge dir1 dir2
(by default results will be stored into merged_profile folder).
Unfortunately gcov-tool allows merging only two profiles at a time but you can use gcov-tool-many to work around this.

how to change the path of source file which was referred gcda?

When i build my project for coverage testing with "--coverage -fprofile-arcs -ftest-coverage", and then move the build and source to the other user directory to execute testing. I will get so many problems such as "xxx/cc/cc/getopt_log.c:cannot open source file"
the details as the below:
Processing cs/CMakeFiles/cfa/__/src/base/fault_injection.c.gcda
/home/cov/build/xfcq/src/base/fault_injection.c:cannot open source file
the path of "/home/cov/build/xfcq/src/base/fault_injection.c" is the path of build environment, how to change it as the relative path or the path I specified.
I tried to use GCOV_PREFIX and GCOV_PREFIX_STRIP, these can't work well for me.
I also tried to add -b option for lcov, it does not also work well for me.
e.g., lcov --gcov-tool=/bin/gcov -d . -b xx/src -t "xfcq" -o test_cov.info
do you have idea to resolve it?
Well for using gcov coverage process you should never move the files after building your project, instead you should modify your automated build scripts to build everything to the desired location.
When you compile your project with the specified options it generates *.gcno files for each source file which are necessarily the flow chart like details of the relevant source file.
So, the object files are instrumented in such a way that they should trigger function(added by compiler to generate coverage info ) whenever any line of statement is executed to generate *.gcda files with all the execution information.
Note: I can see that you have specified three options in question (--coverage -fprofile-arcs -ftest-coverage) which is again wrong, as --coverage works as a replacement to the other two.
If you specify only --coverage then it will do for the compilation and the linking too.(remember to use it at both the places positively though)

How to get jenkins to run my qunit test using phantomjs

Im working on getting our CI (Jenkins) to use and run our qunit test, we have qunit-reporter, qunit.compposite and phantomjs to execute the whole. Im not ant expert so im using windows batch command as a prestep with the following command
phantomjs src\test\webapp\js\runner.js src\test\webapp\jquery.all.test.html > test-report.xml
Now this runs and generates the junit xml file, with a few issues, firstly since I use pipe phantomjs performance information is also put into the file so that's my first issue
My second issue is that I have no idea in the world how I can get Jenkins to actually read the xml file instead of just considering it random stuff, similar to it interpreting when we have junit test run.
Just for reference the project is a maven project.
All advice is welcome :)
In Jenkins, configure your job, add a post build action, select publish JUnit test result report then add the path to your xml file in the requested field.
A couple years ago, a colleague of mine and I worked on getting PhantomJS to run QUnit tests and output JUnit XML that Jenkins can consume:
http://www.cameronjtinker.com/post/2013/09/24/QUnit-JSCoverage-and-Jenkins.aspx
I had forgotten to post this on my blog after we worked on this so I just posted it today when I saw your question. Much has changed since 2011 when this was originally written, but it should have most of the same concepts involved.

How to generate code coverage file with Frank automation - Locally (Without Jenkins/Hudson)

I've seen various articles describing how to run Frank automation on Jenkins/Hudson using headless app running method. But is there a possibility to run the Frank Automation locally and generate the coverage files (gcno, gcda?)
How to make the test App quit gracefully with Frank and get the gcno and gcda ?

Resources