On Fri, May 13, 2005 at 05:18:40PM +0100, Tim Bunce wrote: > On Fri, May 13, 2005 at 10:51:56AM +0200, Paul Johnson wrote: > > On Fri, May 13, 2005 at 03:00:39PM +1000, [EMAIL PROTECTED] wrote: > > > > > [EMAIL PROTECTED] wrote: > > > > > > >Covering the XS portion of the code with gcov is possible, and > > > >Devel::Cover > > > >will create all kinds of nice webpages and statistics for you too. > > > >Paul Johnson may have this written up somewhere, but, if not, I should > > > >really write something up about this since I've used it to determine > > > >Perl's > > > >test coverage. > > > > I don't think I have written anything except the docs for gcov2perl, > > which are minimal and incomplete. I'd be happy to take doc patches for > > gcov2perl if you think that's the right place to document this. > > > > > Generating coverage tests for XS code - why are my hands shaking ? > > > > It's not really that difficult. You just need to get the right options > > to gcc, either by compiling your perl with those options which means > > they will automatically be passed to your XS code, or by making sure > > your XS code is compiled with those options. Then, on running your > > tests, you will get one or more gcov files which you can run through > > gcov2perl to add the gcov data to your perl coverage database. Then, > > running one of Devel::Cover's reports will report on your XS code along > > with your Perl code. > > > > OK. In principle it's not really that difficult. > > Would be _great_ if that could all be automated as far as possible. > I presume the gcov files could be automatically detected and processed, > for example.
I have recently released Devel::Cover 0.55 which has support for this. If you are in a standard ExtUtils::MakeMaker environment you should just be able to type $ perl Makefile.PL $ cover -test and get a report with all your coverage, including gcov information if available. In a slightly less standard environment, such as that provided by Module::Build, that might not work. In that case the (recently updated) docs for gcov2perl might give some clues on what to do, and I'd be pleased to receive patches to make cover -test more general (and robust). The slides for my presentation at YAPC in Braga also have a little information on this topic. http://www.pjcj.net/yapc/yapc-eu-2005-dc-advanced/slides/ -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net