我在 macosx 平台上使用 gcov 进行覆盖测试。我通过 set 完成 xcode 的配置:
1. Build Settings ==> Generate Test Coverage Files == Yes
2. Build Settings ==> Instrument Progaram Flow == Yes
3. Build Phases ==> Link Binary with library ==> add "libprofile_rt.dylib"
然后生成文件“ Test.d, Test.dia, Test.gcno, Test.gcda, Test.o
”然后我使用gcov-4.2 -b Test.gcno
命令生成Test.m.gcov
文件(这是我想要的),但是下次我再次运行测试用例时,文件“ Test.d, Test.dia, Test.gcno, Test.gcda, Test.o
”将再次生成,并且数据将被重置。
所以我有两个问题:
- 有什么方法可以让我累积这些覆盖文件中的数据,以便我可以运行我的项目很多次,然后在最后生成文件。
如果#1 是无望的,你能告诉我如何将
merge two Test.gcno
文件(通过两次运行生成)合并为一个。我在终端中尝试 gcov,以下是 gcov 命令的选项:gcov-4.2 -help Usage: gcov [OPTION]... SOURCEFILE Print code coverage information. -h, --help Print this help, then exit -v, --version Print version number, then exit -a, --all-blocks Show information for every basic block -b, --branch-probabilities Include branch probabilities in output -c, --branch-counts Given counts of branches taken rather than percentages -n, --no-output Do not create an output file -l, --long-file-names Use long output file names for included source files -f, --function-summaries Output summaries for each function -o, --object-directory DIR|FILE Search for object files in DIR or called FILE -p, --preserve-paths Preserve all pathname components -u, --unconditional-branches Show unconditional branch counts too For bug reporting instructions, please see: <URL:http://developer.apple.com/bugreporter>.
感谢您提前提供的所有帮助