2

I am trying to run the code coverage on a C/C++ software. The generation of gcno files is fine (I have more than 6000 of them) while I only get 240 gcda files.

I am running Mac OS X 10.9.3 with Xcode 5.5.1. Building with:

export CFLAGS="-fprofile-arcs -ftest-coverage"
export CXXFLAGS="-fprofile-arcs -ftest-coverage"
export LDFLAGS="-fprofile-arcs -ftest-coverage --coverage"

I saw a potential solution with gcov_flush(): Generate gcda-files with Xcode5, iOS7 simulator and XCTest but I don't want to touch the sources of the software or the tests (and I would like to avoid Objective-C). Any clue?

Community
  • 1
  • 1
Sylvestre
  • 352
  • 1
  • 7
  • Only code that was executed should ever generate .gcda, and not every single function in program is executed. .gcno however created by compiler, so you get all of them even before execution. – keltar Jun 20 '14 at 09:37
  • Yeh, I know. I am running 4 days of tests but the gcda number remains the same. – Sylvestre Jun 20 '14 at 14:22
  • It doesn't matter how long tests are running; they just don't use every function. Coverage analysis usually targeting some 'intended' use of code, and then applies profiling data to make *this* use faster; other cases, in return, may slow a bit. Unless you 100% sure that one specific function was called but there is no coverage data for it, then there is no problem at all. – keltar Jun 20 '14 at 14:25
  • I know all that... I just meant that I am running all tests and running the same tests under GNU/Linux gives me about 50% coverage. There is a problem with Xcode 5.1.1 and I would like to avoid the workaround proposed in the stackoverflow page that I linked. – Sylvestre Jun 20 '14 at 14:48

0 Answers0