[TIP] testing-in-python Digest, Vol 63, Issue 11
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Wed Apr 18 07:24:15 PDT 2012
On 17 Apr, 07:00 pm, testing-in-python-request at lists.idyll.org wrote:
>Message: 4
>Date: Tue, 17 Apr 2012 01:17:57 +0100
>From: David Cournapeau <cournape at gmail.com>
>Subject: Re: [TIP] C-extension coverage
>To: francismb at email.de
>Cc: testing-in-python at lists.idyll.org
>Message-ID:
> <CAGY4rcX5cEaBZvC639HkMWmcCgREXqn2rexd8XH-
>gNpxhkF=1Q at mail.gmail.com>
>Content-Type: text/plain; charset="utf-8"
>
>On Wed, Apr 11, 2012 at 8:49 PM, francis <francismb at email.de> wrote:
>>Hi all,
>>
>>I would like to have line and branch coverage of a Python C-extension
>>by
>>using gcc-coverage (gcov). AFAIN to be able to use gcov for that, the
>>extension
>>module has to be compiled statically: means in that case the
>>interpreter,
>>the
>>tests (written in python with unittest) and the C-extension itself. I
>>wonder if that
>>can be achieved with py2exe or some of it's pendants...
>>
>>If someone has already gone that path or did something similar ? any
>>idea
>>is
>>appreciated.
>
>That's tricky. As you mentioned, gcov does not work with shared
>libraries
>as is, so you need to statically link your extensions into python:
>that's
>not easy either.
Hmmm. Really? That's strange. I don't think I've ever needed to do
that:
http://buildbot.twistedmatrix.com/builds/twisted-coverage-report/
Here's how the extensions are built for that report:
http://buildbot.twistedmatrix.com/builders/twisted-gcoverage/
Notice the CFLAGS set in the compile step environment.
You can find the buildbot code for this in lp:twisted-buildbot-
configuration.
Jean-Paul
More information about the testing-in-python
mailing list