gcov

Why does gcov report 0% coverage on a header file for a well used class?

六眼飞鱼酱① 提交于 2019-12-01 06:15:26
问题 I'm attempting to measure test coverage for the first time using gcov. Now that I'm past the initial learning curve, things seem to be going well, except for one little snag. I expect that it boils down to a lack of understanding on my part, so I'm hoping someone familiar with gcov can explain what's going on. The issue is that I have one particular header file showing 0% coverage. However the only thing in that header is a class declaration for a well-used class. In addition, The

can gcov deal with shared object?

可紊 提交于 2019-11-30 23:56:33
I am recently using gcov to collect the code coverage info. gcov plays well with executable application :) , but when I try to load a .so file, I got this error: unknown symbol __gcov_merge_add. Then I search on Google and someone said adding -lgcov to the link flag(LDFLAGS), I did add this option and it didn't work. I also try on --coverage option in link flag, cannot get rid of this error. Can someone help on this issue? Thank you. deuberger I ran into that problem too, but have since solved it. I just use the --coverage option in both CPPFLAGS and LDFLAGS. I think that should take care of

How to force gcov to extract data, even when program is aborted

白昼怎懂夜的黑 提交于 2019-11-30 20:46:58
I'm using a test-generating tool called KLEE, that creates lots of tests for my C99-Code. Afterwards I run the tests and check line coverage with gcov. Gcov seems to update coverage data at the end of the run upon successful completion. However, some tests fail (assert statements that are not true), which leads to aborting the program and gcov not counting the lines covered in this run. Is there any way that gcov flushes information on any exit (not only on successful)? Call void __gcov_flush(void) (from libgcov.a which is linked in by -fprofile-arcs option of compiler) in your assert code,

configuring code coverage with cmake

馋奶兔 提交于 2019-11-30 15:57:26
I'm on a linux machine, trying to build a project using cmake that does out of source builds. For code coverage, I looked into gcov and followed a simple tutorial that generate appropriate files for a sample helloWorld.cpp program. The only requirement were to compile with -fprofile-arcs -ftest-coverage flags & link with -lgcov flag, which can be done altogether with -coverage flag. Now here comes the tricky part. I have a CMakeLists.txt wit contents as shown below: cmake_minimum_required (VERSION 2.8) project (SomeName) SET(GCC_COVERAGE_COMPILE_FLAGS "-g -O0 -coverage -fprofile-arcs -ftest

configuring code coverage with cmake

瘦欲@ 提交于 2019-11-30 15:50:14
问题 I'm on a linux machine, trying to build a project using cmake that does out of source builds. For code coverage, I looked into gcov and followed a simple tutorial that generate appropriate files for a sample helloWorld.cpp program. The only requirement were to compile with -fprofile-arcs -ftest-coverage flags & link with -lgcov flag, which can be done altogether with -coverage flag. Now here comes the tricky part. I have a CMakeLists.txt wit contents as shown below: cmake_minimum_required

Is there any actively supported lcov port for windows

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 15:12:54
I measure coverage for my code using gcov library and I would like to generate coverage report in user-friendly format. I've found lcov utility for that, but it's not compatibile with Windows environment (mainly because of the way the paths are parsed). Does anyone know about actively supported lcov port for Windows? It seems that making it work on Windows would be quite easy (it think it might even be solved by few creative batch/perl scripts that mimic the behavior of unix shell commands), and the tool is quite useful, so I suppose someone might have already done it. John Paulett While it

How to set up gcov for code coverage analysis in iPhone SDK?

家住魔仙堡 提交于 2019-11-30 08:39:09
问题 I've recently begun unit testing an app I write for the iPhone. I have the basics of creating my own tests down, even if it seems a little sub-optimal. I am, however, having real trouble setting up code coverage analysis using gcov. I followed the instructions here: http://www.cubiclemuses.com/cm/articles/2009/05/14/coverstory-on-the-iphone/, which are repeated very similarly in other places. I've tried using Google's AppleScript from their toolbox for Mac to do it just in case I was entering

XCode 5.1 Unit Test Coverage Analysis Fails On Files Using Blocks

霸气de小男生 提交于 2019-11-30 06:18:58
问题 Today I was tasked with adding unit test coverage analysis to our code base. Today is also the day iOS 7.1 is released along with XCode 5.1. From the release notes: The gcov tool for code coverage testing has been reimplemented. The new version uses the llvm-cov tool from the LLVM project. It is functionally equivalent to the old version for all significant features. The location of gcov within Xcode has also moved, use xcrun to invoke it. If you find problems, please file bug reports. For

Is it possible to merge coverage data from two executables with gcov/gcovr?

若如初见. 提交于 2019-11-30 06:06:26
On one project, I'm running the test cases on three different executables, compiled with different options. Depending on the options, some code paths are taken or not. Right now, I'm only using the coverage data from one executable. I'm using gcovr to generate a XML that is then parsed by Sonar: gcovr -x -b -r . --object-directory=debug/test > coverage_report.xml I have three sets of gcda and gcno files, but I don't know how to generate a global report of them. Is there any way to do that ? Assuming that by "compiled with different options" you mean that you compile such that you obtain

Getting useful GCov results for header-only libraries

雨燕双飞 提交于 2019-11-30 04:43:13
For my header-only C++ library (lots of templates etc) I use GCov to check test coverage. However, it reports 100% coverage for all headers because the unused functions aren't generated by the compiler in the first place. Manually spotting uncovered functions is easy but defeats the purpose of continuous integration… How does one solve this automatically? Should I just use "lines hit / LOC" as my coverage metric and just never reach 100% again? Apart from the usual flags to GCC controlling inlining; --coverage -fno-inline -fno-inline-small-functions -fno-default-inline You can instantiate your