Closed arnavb closed 5 years ago
UPDATE:
Well, this problem no longer exists for me, since I switched to doctest which was much faster and could handle the flags.
I'm still leaving this issue open since it isn't resolved yet.
Can not reproduce with 2.5.0.
Description
Ok, so this is a problem I have been having for a while, but I have no way to solve. In my repository (arnavb/cpp14-project-template#1), I have been trying to add code coverage so I can see the effectiveness of my tests. To do so, I have been using this module. In order to apply code coverage, I added the following CMake code:
Now this does work, I can confirm (without using Catch), as you can see in arnavb/test-codecov in an older commit. However, when I add Catch tests to the project (it's newest commit), I get a compilation freeze since the Coverage flags are seriously slowing down the Catch code. (I waited a few minutes, and the compilation still hasn't finished). Now I thought: Hey! maybe I can just apply the flags to the library I'm testing! In order to do that, I commented out
append_coverage_compiler_flags()
and added the following to mysrc/CMakeLists.txt
:Now this does work, but only partially. Now, when I try to compile, the compilation finishes quickly for the tests. However, if there is a function present that is defined just in a header file (such as a template function), it's coverage is completely ignored! I asked a question on SO to try and solve this and got the following response in a comment:
So it seems that the test files I'm using DO need the coverage flags, but I can't apply them without a compilation freeze. As such, I'm at a loss for what to do. How can I speed up the compilation of my code?
Steps to reproduce
If you want an example of the compilation freeze with Catch, then follow the build steps in arnavb/test-codecov.
Extra information
Thanks for taking the time to read this; I know it's a lot!