<p>I have a very large code base that contains extensive unit tests (using CppUnit). <b>I need to work out what percentage of the code is exercised by these tests</b>, and (ideally) generate some sort of report that tells me on a per-library or per-file basis, how much of the code was exercised.</p>

<p>Here's the kicker: this has to run completely unnatended (eventually inside a continuous integration build), and has to be cross platform (well, WIN32 and *nix at least).</p>

<p>Can anyone suggest a tool, or set of tools that can help me do this? I can't change away from CppUnit (nor would I want to - it kicks ass), but otherwise I'm eager to hear any recommendations you might have.</p>

<p>Cheers,</p>

Which tool should I use?
This
article describes
another developers frustrations searching for C++ code coverage tools.  The author's final solution was
Bullseye Coverage
.
Bullseye Coverage
features:
Cross Platform Support
(win32, unix, and embedded), (supports linux gcc compilers and MSVC6)
Easy to use
(up and running in a few hours).
Provides "best" metrics
: Function Coverage and Condition/Decision Coverage.
Uses source code instrumentation.
As for hooking into your continuous integration, it depends on which CI solution you use, but you can likely hook the instrumentation / coverage measurement steps into the make file you use for automated testing.
Testing Linux vs Windows?
So long as all your tests run correctly in both environments, you should be fine measuring coverage on one or the other.  (Though Bullseye appears
to support both platforms
).  But why aren't you doing continuous integration builds in both environments??  If you deliver to clients in both environments then you
need
to be testing in both.
For that reason, it sounds like you might need to have two continuous build servers set up, one for a linux build and one for a windows build.  Perhaps this can be easily accomplished with some virtualization software like
vmware
or
virtualbox
.  You may not need to run code coverage metrics on both OSs, but you should definitely be running your unit tests on both.