gcov

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

怎甘沉沦 提交于 2019-11-29 02:38:43
问题 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 ?

How do I tell gcov to ignore un-hittable lines of C++ code?

邮差的信 提交于 2019-11-29 00:18:20
问题 I'm using gcov to measure coverage in my C++ code. I'd like to get to 100% coverage, but am hampered by the fact that there are some lines of code that are theoretically un-hittable (methods that are required to be implemented but which are never called, default branches of switch statements, etc.). Each of these branches contains an assert( false ); statement, but gcov still marks them as un-hit. I'd like to be able to tell gcov to ignore these branches. Is there any way to give gcov that

How to resolve __gcov_init undefined reference issue when linking

人走茶凉 提交于 2019-11-28 22:05:36
问题 I now work on C code coverage study and encountered following issue, GCC version 4.4.6: Added compiler flag CFLAGS = --coverage and linker option LDFLAGS := --coverage or LOCAL_LDLIBS := --coverage and got the error: undefined reference to '__gcov_init'" and "undefined reference to '__gcov_merge_add' Added option LOCAL_LDFLAGS := --coverage , and got link error: libgcov.a(_gcov.o): in function __gcov_set_sampling_rate: undefined reference to '__gcov_sampling_rate' libgcov.a(_gcov.o): in

Why doesn't gcov report any lines being covered by my unit tests?

房东的猫 提交于 2019-11-28 21:26:35
I am using Xcode 3.2 on 10.6, with the shipped version of gcov and default GCC compiler (both version 4.2.1). I have created a dependent Cocoa unit test bundle which is injected into my app, and followed Apple's documentation on setting up a gcov-instrumented build configuration - based on the Debug configuration which doesn't have any compiler optimisations enabled. When I build the test bundle with this 'Gcov-instrumented' configuration, the app launches and the tests are injected and run. Also the coverage statistics files are generated at: build/<AppTarget>.build/Gcov-instrumented/

gcov: producing .gcda output from shared library?

前提是你 提交于 2019-11-28 19:06:21
问题 Is it possible to produce gcov data files ( .gcda files) by running an executable linked to a shared library built with the --coverage option? Basically, I have the main library consisting of multiple c++ files compiled into one shared library and then a subdirectory called "test" containing a test program that links to and tests the main library. Everything compiles fine and the .gcno files are produced for both the library source files and the test source files. The .gcda files are only

XCode 5.1 Unit Test Coverage Analysis Fails On Files Using Blocks

杀马特。学长 韩版系。学妹 提交于 2019-11-28 17:04:07
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 this release, you can still use the old version of gcov from GCC, which is available as gcov-4.2.

Where are the gcov symbols?

折月煮酒 提交于 2019-11-28 15:52:36
I'm trying to compile a simple app with gcov and getting the following link errors: gcc AllTests.o CuTestTest.o CuTest.o -o TestTest AllTests.o: In function `global constructors keyed to 0_RunAllTests': /home/p7539c/cutest/AllTests.c:26: undefined reference to `__gcov_init' AllTests.o:(.data+0x44): undefined reference to `__gcov_merge_add' CuTestTest.o: In function `global constructors keyed to 0_TestCuStringNew': /home/p7539c/cutest/CuTestTest.c:30: undefined reference to `__gcov_init' CuTestTest.o:(.data+0x64): undefined reference to `__gcov_merge_add' CuTest.o: In function `global

GCOVR giving empty results zero percent in MAC

核能气质少年 提交于 2019-11-28 11:55:08
问题 I have the .gcda and .gcno files in a folder, from which I am running the below command. $ gcovr -r . and the result is as below if I run gcov on the gcda files I get the proper coverage value. 回答1: After a tedious search in multiple forums and countless experiments, finally I figured out the issue and resolved it. Two things are important to get the proper output from gcovr. One is from where the gcovr is executed and other is the root directory path. gcovr should be executed from the folder

With gcov, is it possible to merge to .gcda files?

丶灬走出姿态 提交于 2019-11-28 09:17:41
I have the same source files (C and Obj-C) being compiled into two targets: the unit test executable and the actual product (which then gets integration tested). The two targets build into different places, so the object files, .gcno and .gcda files are separate. Not all source files are compiled into the unit test, so not all objects will exist there. All source files are compiled into the product build. Is there a way to combine the two sets of .gcda files to get the total coverage for unit tests and integration tests (as they are run on the product build)? I'm using lcov. Mac OS X 10.6, GCC

No code coverage with Mac OS X Lion and XCode 4 / llvm-g++-4.2

感情迁移 提交于 2019-11-28 08:27:42
问题 Other people have reported not being able to generate code coverage with XCode 4, but I find not only can I not do it from within XCode 4, I can't do it even with a simple toy program from the command line. I followed the examples given here and here, which led me to create this cov.c file: #include <stdio.h> int main (void) { int i; for (i = 1; i < 10; i++) { if (i % 3 == 0) printf("%d is divisible by 3\n", i); if (i % 11 == 0) printf("%d is divisible by 11\n", i); } return 0; } I then used