Is it possible to use gcov for coverage testing of multi-threaded applications?
I’ve set some trivial tests of our code-base up, but it would be nice to have some idea of the coverage we’re achieving. If gcov isn’t appropriate can anyone recommend an alternative tool (possible oprofile), ideally with some good documentation on getting started.
We’ve certainly used gcov to get coverage information on our multi-threaded application.
You want to compile with gcc 4.3 which can do coverage on dynamic code.
You compile with the
-fprofile-arcs -ftest-coverageoptions, and the code will generate .gcda files which gcov can then process.We do a separate build of our product, and collect coverage on that, running unit tests and regression tests.
Finally we use lcov to generate HTML results pages.