CLion's coverage interface. No popup window asking me how to handle multiple test suites and how to exclude directories from coverage reports?

已回答

I'm trying to get coverage statistics for my software but I have a couple of question. Firstly, I'm using GCC and have added `-fprofile-arcs -ftest-coverage` to my cmake compile flags and recompiled. Now  CLion will let me run with coverage and generate statistics. One of my problems is that I have 2 test suites. The documentation suggests that I should be presented with a pop up window asking me whether I want to accumulate the test statistics or replace them. However I am not presented with such a window and the test statistics are not accumulated, as far as I can tell. Moreover, the coverage settings in clion do not seem to do much (though I could be wrong since). 

The second problem I have is that I have a lot of third party source code embedded into my code (the googletest framework) for example. Is it possible to exclude these from the coverage as these extra libraries are distorting my coverage report - currently my report shows around 40% when I suspect its closer to 80%. 

I'm using CLion version 2020.1.2 on WSL2 and I'm hooked up to GCC 10.1 with gcov-10

1

Hello!

>However I am not presented with such a window and the test statistics are not accumulated, as far as I can tell.

This dialog appears only when the compiler and the coverage tooling are changed: for example, if you first collect code coverage data using gcc, and then rebuild the project with clang, update the compiler flags and run the application with coverage once again  in this case the dialog will appear.

> Is it possible to exclude these from the coverage as these extra libraries

The most correct way is simply not to build third party libraries with these compiler flags — therefore code coverage data will not be collected for them. Unfortunately, there is no UI option to exclude such directories.

0

请先登录再写评论。