Xcode 7 generating GCOV
Asked Answered
W

2

9

so the hot new feature in Xcode 7 is code coverage integrated within XCode - yaaay! With this new feature also comes Apple's new code coverage format .profdata.

We need to display code coverage reports in Cobertura reports (loaded in Jenkins). Currently there is no way to convert .profdata to Cobertura XML report (it is on its way however).

Until then, we need to rely on the "old" gcov. For some unknown reason XCode 7 generates .gcno and .gcda, BUT when you let gcovr to create the Cobertura reports it shows 0% coverage for all files (we surely have some coverage).

We tried to go back to XCode 6.4 and the generated gcov files shows the right coverage when run through gcovr.

Is anyone experiencing the same problem? Any possible solutions?

Windblown answered 22/10, 2015 at 17:38 Comment(2)
If you would like to use a hosted service: github.com/codecov/example-swift (Slather is an option too github.com/venmo/slather/pull/99)Odor
Did you figure this out?Gospel
L
0

gcovr should be executed from the folder where the .gcda and .gcno files exist. And the root path is the folder where the source files(.c or .cpp) exist.

With this, the command looks like something as shown below.

rr-mac:gcdaFolder$ gcovr -r /path_to_C_sourceFiles/ .

For output html file below command works

rr-mac:gcdaFolder$ gcovr --html -o Filename_rp.html -r /path_to_C_sourceFiles/ .

Note: The dot(.) at the end is mandatory

Louls answered 12/8, 2016 at 12:57 Comment(0)
S
-1

Set next values in Build Settings of your target:

Generate Legacy Test Coverage Data = YES
Instrument Program Flow = YES
Enable Code Coverage Support = NO
Snug answered 29/3, 2016 at 11:48 Comment(1)
Why are you down-voting without explanation? It worked for me.Snug

© 2022 - 2024 — McMap. All rights reserved.