[Bro-Dev] bro and code coverage

Jonathan Siwek jsiwek at ncsa.illinois.edu
Mon Dec 13 08:31:48 PST 2010


> The gcc/g++ flags to enable gcov output are "-fprofile-arcs
> -ftest-coverage". Are those something that should be added to the
> build system? I don't think they need added to the configure script,
> but maybe to the CMakeLists.txt file?

If that's really all that's needed I think you could get away with just passing the flags through environment variables in the standard way to the configure script, e.g.:

    CFLAGS="-fprofile-arcs -ftest-coverage" CXXFLAGS="-fprofile-arcs -ftest-coverage" ./configure

Passing the flags only works for the first-time configure of a given build directory.

The lcov doc you referenced also mentioned linking to -lgcov.  If something like that's necessary, it probably makes sense to add a --enable-code-coverage option to the configure wrapper that triggers CMake to search for the required stuff and, if it's all there, add the necessary compile and link flags, else fail.

- Jon


More information about the bro-dev mailing list