|Regex based file filter for Gcov coverage outputs [message #987923]
||Wed, 28 November 2012 11:39
| Tamas Kleiber
Registered: December 2010
I'm using the latest release version of the Gcov plugin together with the google test framework to unit test embedded C software components coming from the hardware abstraction layer.
To fake or mock up given aspects of these low level C modules without polluting the production code itself with conditional compilation switches for testing purposes, I have to include the C module itself into the unit test module instead of the C module's interface header. This way it is possible to make all necessary changes to the C module under test using the C preprocessor without the need to alter the production code.
#include "gtest/gtest.h" /* include gtest */
/* override INLINE compiler abstraction macro for unit testing with GCC */
#define INLINE inline
#include "module.c" /* include module under test */
/* unit testing code */
The approach works perfectly, without altering the production code or polluting it with test code, it was possible to overcome even on the most wicked issues I've seen so far. My only problem is that as my module under test is actually parsed into the unit testing module itself as an include, when I try to use the Gcov plugin to output the coverage info of my compiled module or binary it also outputs all the google test related header files.
Would it be possible to implement an ignore list for files to filter out the unwanted header or other files from the coverage output?
E.g. in the summary view for the whole binary it would be great if I could apply a generic filter to discard a list of files based on a regular expression. A regex could include patters, lists and everything so it would be very generic and would only need to test for the name of the element on the list of the files in the summary. The regex pattern could be input on the open coverage results... dialog window.
Currently if I want to show coverage details for a given C file only, eclipse opens google test's 20+ header files too which would be possible to filter using the same regex based filter approach.
Powered by FUDForum
. Page generated in 0.01773 seconds