本文介绍了代码覆盖率GCov不适用于XCode 4.2和iOS SDK 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图让GCov使用iOS SDK 5.0在Lion上使用Xcode 4.2Build 4D199无济于事。有人有运气吗?我正在使用Google Tools For Mac进行单元测试,我已经在libprofile_rt.dylib中进行了链接并添加了:

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",
);

如此处的Coverstory页面所示
但是当我找到时。 -name * .gcda我空了。我错过了什么?

as indicated on the Coverstory page here http://code.google.com/p/coverstory/wiki/UsingCoverstoryBut when I find . -name *.gcda" I come up empty. What am I missing?

推荐答案

GCov是。你会注意到如果你去他们的,XCode 4.2不是下拉列表中的一个选项。此外,如果你看一下编译,它使用的是c ++,它链接到llvm-g ++ - 4.2。它们现在是专属的使用Clang / LLVM工具链(反过来经常使用gcc工具链),而不是直接使用gcc工具链。这样做的结果是在XCode4中使用<$ c $进行代码覆盖c> gcov 不再直接可用。这也会影响使用绕过XCode 4的CMake编译。为您提供有关如何更改项目以使用 profile_rt 而非<$ c的说明$ c> gcov 。

GCov is no longer supported in XCode 4.2. You'll note that if you go their "man page" for it, XCode 4.2 is not an option in the drop down list. Furthermore, if you look at the compile, it's using "c++", which is linked to llvm-g++-4.2. They now exclusively use the Clang/LLVM tool chain (which in turn often makes use of the gcc tool chain) instead of giving you the option of directly using the gcc tool chain. A consequence of this is that doing code coverage in XCode4 with gcov is no longer directly available. This also can affect compiles using CMake that bypass XCode 4. That first link gives you instructions on how to change your project to use profile_rt instead of gcov.

这篇关于代码覆盖率GCov不适用于XCode 4.2和iOS SDK 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 04:07