With gcov, is it possible to merge to .gcda files?

后端 未结 4 1356
走了就别回头了
走了就别回头了 2020-12-09 20:58

I have the same source files (C and Obj-C) being compiled into two targets: the unit test executable and the actual product (which then gets integration tested). The two tar

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-09 21:38

    I think the intended way to do this is not to combine the .gcda files directly but to create independent coverage data files using

    lcov -o unittests.coverage -c -d unittests
    lcov -o integrationtests.coverage -c -d integrationtests
    

    Each coverage data then represents one "run". You can of course create separate graphs or html views. But you can also combine the data using --add-tracefile, -a for short

    lcov -o total.coverage -a unittests.coverage -a integrationtests.coverage
    

    From the total.coverage you can generate the total report, using genhtml for example.

提交回复
热议问题