在 Xcode 3.1 中设置 gcov
我正在尝试将 Xcode 项目设置为使用 gcov 进行检测,以便我可以确定单元测试的代码覆盖率。不过,我在网上找到的所有文档都讨论了我在 Xcode 3.1 中找不到的设置。一个例子:
要使用 Coverstory,首先您需要设置目标以使用 gcov。这需要打开“仪器程序流程”、“生成测试覆盖率文件”并与 gcov 库链接。 (使用 Coverstory)
我能找到的最接近“仪器程序流程”的内容我的构建设置中的“生成测试覆盖文件”是“生成分析代码”,它似乎没有执行我想要的操作。
我是否在错误的位置查找这些设置,或者我在网上找到的所有示例都已过时?
I'm trying to setup my Xcode project to be instrumented with gcov so I can determine the code coverage of my unit tests. All of the documentation I find online talks about settings that I don't find in Xcode 3.1, though. An example:
To work with Coverstory, first you need to set up your target to work with gcov. This requires turning on "Instrument Program Flow", "Generate Test Coverage Files" and linking with the gcov library.
(Using Coverstory)
The closest thing I can find to "Instrument Program Flow" and "Generate Test Coverage Files" in my build settings is "Generate Profiling Code", which doesn't appear to do what I want it to do.
Am I looking in the wrong place for these settings or are all of the examples I'm finding online stale?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更新:当我第一次设置这个时,我回顾了我的笔记 - 你的“Base SDK”必须与你当前的构建目标相同,否则你需要的选项将不会出现:
http://iphonesdkdev.blogspot.com/2009/05/xcode- gcc-section-missing-in-build.html
仅供参考,我的“仪器程序流程”和“生成测试覆盖文件”选项显示在标题“GCC 4.0 - 代码生成”下方。
我记得隐藏构建设置的类似问题 - 通常是因为依赖于另一个构建设置,例如我知道重要的项目中的两个是:
-C/C++ 编译器版本 = GCC 4.0
- 基础 SDK = iPhone Simulator 2.1(缺失)
Update: I've looked back at my notes when I first set this up - your "Base SDK" has to be the same as your current build target, otherwise the options you need won't appear:
http://iphonesdkdev.blogspot.com/2009/05/xcode-gcc-section-missing-in-build.html
FYI, my "Instrument Program Flow" and "Generate Test Coverage Files" options show up underneath heading "GCC 4.0 - Code Generation".
I remember similar problems with build settings being hidden - usually it is because of a dependency on another build setting, e.g. two from my project that I know matter are:
-C/C++ Compiler Version = GCC 4.0
-Base SDK = iPhone Simulator 2.1 (missing)
您可能还想查看 Google Toolbox For Mac Xcode 插件,它添加了菜单项以轻松设置代码覆盖率:
http://code.google.com/p/google-toolbox-for-mac/wiki/GTMXcodePlugin
You may also want to check out the Google Toolbox For Mac Xcode Plugin which adds menu items for easily setting up code coverage:
http://code.google.com/p/google-toolbox-for-mac/wiki/GTMXcodePlugin