gcov

Code Coverage GCov not working with XCode 4.2 and iOS SDK 5

梦想与她 提交于 2020-01-30 06:45:30
问题 I've been trying to get GCov working with Xcode 4.2Build 4D199 on Lion with iOS SDK 5.0 to no avail. Has anyone had any luck with this? I'm using Google Tools For Mac for my unit tests and I've linked in libprofile_rt.dylib and added: "OTHER_CFLAGS[arch=*]" = ( "-ftest-coverage", "-fprofile-arcs", "-falign-loops=16", ); as indicated on the Coverstory page here http://code.google.com/p/coverstory/wiki/UsingCoverstory But when I find . -name *.gcda" I come up empty. What am I missing? 回答1: GCov

Why gcc 4.1 + gcov reports 100% branch coverage and newer (4.4, 4.6, 4.8) reports 50% for “p = new class;” line?

筅森魡賤 提交于 2020-01-19 03:28:05
问题 When gcc 4.1 (using gcov) next line: p = new Class; is reported as 100% branch coverage <-- THIS IS OK for me. Why using gcc 4.4 and higher same line is reportted as: [+ -] p = new Class; (50% branch coverage)... <-- THIS IS a problem for covering 100% !!! Can I set any extra options to newer gcc versions in order to report same branch coverage as gcc 4.1 for single lines as "p = new Class;". Thanks in advance. 回答1: Solved ! We have some C/C++ files with and without exceptions handling, so

Remove auto generated exception code from coverage report

丶灬走出姿态 提交于 2020-01-14 14:23:26
问题 Let's start with a minimal working example: main.cpp: #include <iostream> #include <string> int main() { std::cout << "hello " + std::to_string(42); return 0; } I compile this code using the following flags: [g++/clang++] -std=c++11 -g -Og --coverage -Wall -o main main.cpp clang 4.0.1 gcc 4.8.5. I get only 50% code coverage, since the compiler generates exception code, which is not executed, as explained in another stackoverflow question. The problem is that disabling exceptions via -fno

GCC6.3.0: flag “--coverage” not functioning (no gdca files generated)

血红的双手。 提交于 2020-01-11 12:56:29
问题 Having a code snippet in C and the same in C++, which generates gdca files executing the exe which is compiled with GCC 4.1.2. The same code snippet compiled with GCC6.3.0 after executing is not generating gdca files, not the C.exe not the c++.exe I found out that the implementation of the gcov library is different, in GCC4.1.2 and GCC6.3.0, the version of the gcov library in GCC6.3.0 seems to be empty: _gcov_merge_add.o: file format elf32-i386 Disassembly of section .text: 00000000 <__gcov

Code coverage warrnings spam output

风格不统一 提交于 2020-01-07 02:37:29
问题 In CMake tests configuration I added flags to generate codecoverage IF( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage ") endif() Each time I run tests - my output is spammed with those messages: profiling: /xxxx/xxxxxj/projects/build-xxxxx-CLang-Debug/tests/CMakeFiles/xxxxxxxxxxxxxt_ut.dir/tests/gui/ship_design/ut

.gcda files don't merge on multiple runs

眉间皱痕 提交于 2020-01-05 04:21:31
问题 I have two main functions that use a common C++ class. File1: main.cpp #include <iostream> #include "HelloAnother.h" int main() { HelloAnother::sayHello1(); return 0; } File2: main2.cpp #include <iostream> #include "HelloAnother.h" int main() { HelloAnother::sayHello2(); return 0; } File3: HelloAnother.h #pragma once class HelloAnother { public: static void sayHello1(); static void sayHello2(); }; File4: HelloAnother.cpp #include <iostream> #include "HelloAnother.h" void HelloAnother:

gcov with CMake using a separate build directory

☆樱花仙子☆ 提交于 2019-12-30 02:08:20
问题 I'm struggling to get coverage information for gcov. No errors during compilation and linking, but when I run the executable, no coverage data is produced. I'm using CMake with a separate build directory, passing flags to the compiler and linker in this way: add_definitions(--coverage) set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} " --coverage") Does the executable expect the source code to be in a specific location? What do I have to add to my CMakeLists.txt to get things going? Kind

gcov not generating gcda files

让人想犯罪 __ 提交于 2019-12-29 07:57:10
问题 I tried to run gcov with -fprofile-arcs & -ftest-coverage and nothing for linking. It was giving this error:- hidden symbol `__gcov_init' in /home/mojave/tools/gcc-4.4.1/amd64/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.4.1/libgcov.a(_gcov.o) is referenced by DSO and program exits. Command to compile- bsub -g /mojave/build/"DummyDate" -J compile-obj/linux24rhel3_x86_64_GCOV64/DXp.o -I -q DFM -S 8192 -R "(model==OPTERON_250)" '/usr/bin/time --format=" ...finished DXp [`hostname`] [%E s with %P

Why does CMake neglects source files?

萝らか妹 提交于 2019-12-24 07:56:23
问题 The CMakeLists.txt file I wrote, unfortunately, create coverage statistics solely for header files and test scripts, but not for the source files. I would, however, like to heave coverage information for the source files. What am I doing wrong? As an example, here is the header file: class.h #include <string> #include <vector> #include <iostream> class StrVec{ public: StrVec(const std::string&); void print() {std::cout << vec[0] << std::endl;} private: std::vector<std::string> vec; }; The

Getting 0 gcov coverage for a mac app

一个人想着一个人 提交于 2019-12-24 00:57:51
问题 I have done the following but I am still getting 0% gcov coverage for my .app. Here is what I am doing: I am using Xcode 3.2.6, GCC 4.2 and am on Mac OSX 10.6. I duplicated the Debug config and call it Gcov. In the Gcov config and the app target I set the following build configuration: Check "Generate Test Coverage Files" Check "Instrument Program Flow" Add "-lgcov" to "Other Linker Flags" I did a 'Clean All' then I did a 'Build and Run'. Once the build successfully built it launched the app.