c++ - disable gcov coverage at run-time -
i'm writing test in c++ , i'm using gcov (actually lcov think it's beside point) informations coverage.
is there way disable information record @ run-time? e.g. :
bool mytest() { objecttotest obj; /* enable gcov... */ obj.functiontotest(); /* ...disable gcov */ if(obj.getstatus() != whatever) return false; else return true; }
in case gcov display "covered" functiontotest leave objecttotest constructor , getstatus "uncovered".
thanks in advance!
no, in case of gcov don't have such option.
i have seen such options in coverage tools clover works instrumenting source code directly though.
beside solution problem write part of code different source file , call inside desired source file including it.
suggesting because when generate coverage report later using lcov or gcovr both provide option exclude specified files coverage report passing them flags.
lcov:
-r tracefile pattern --remove tracefile pattern remove data tracefile.
gcovr:
-e exclude, --exclude=exclude exclude data files match regular expression
Comments
Post a Comment