[Python-checkins] devguide: Issue #18481: document new C coverage make targets

christian.heimes python-checkins at python.org
Wed Jul 31 01:17:14 CEST 2013


http://hg.python.org/devguide/rev/116b05b98bea
changeset:   633:116b05b98bea
user:        Christian Heimes <christian at cheimes.de>
date:        Wed Jul 31 01:17:03 2013 +0200
summary:
  Issue #18481: document new C coverage make targets

files:
  coverage.rst |  31 +++++++++++++++++++++++++++++++
  experts.rst  |   2 +-
  2 files changed, 32 insertions(+), 1 deletions(-)


diff --git a/coverage.rst b/coverage.rst
--- a/coverage.rst
+++ b/coverage.rst
@@ -227,3 +227,34 @@
 worked on (i.e., the in-development version).
 
 .. _issue tracker: http://bugs.python.org
+
+
+Measuring coverage of C code with gcov and lcov
+"""""""""""""""""""""""""""""""""""""""""""""""
+
+It's also possible to measure the function, line and branch coverage of
+Python's C code. Right now only GCC with `gcov`_ is supported. In order to
+create an instrumented build of Python with gcov, run::
+
+    make coverage
+
+Then run some code and gather coverage data with the ``gcov`` command. In
+order to create a HTML report you can install `lcov`_. The command::
+
+    make coverage-lcov
+
+assembles coverage data, removes 3rd party and system libaries and finally
+creates a report. You can skip both steps and just run::
+
+    make coverage-report
+
+if you like to generate a coverage report for Python's stdlib tests. It takes
+about 20 to 30 minutes on a modern computer.
+
+.. note::
+
+    Multiple test jobs may not work properly. C coverage reporting has only
+    been tested with a single test process.
+
+.. _gcov: http://gcc.gnu.org/onlinedocs/gcc/Gcov.html
+.. _lcov: http://ltp.sourceforge.net/coverage/lcov.php
diff --git a/experts.rst b/experts.rst
--- a/experts.rst
+++ b/experts.rst
@@ -324,7 +324,7 @@
                     georg.brandl
 str.format          eric.smith
 testing             michael.foord, pitrou, ezio.melotti
-test coverage       ncoghlan, giampaolo.rodola
+test coverage       ncoghlan, giampaolo.rodola, christian.heimes
 threads             pitrou
 time and dates      lemburg, belopolsky
 unicode             lemburg, ezio.melotti, haypo, benjamin.peterson, pitrou

-- 
Repository URL: http://hg.python.org/devguide


More information about the Python-checkins mailing list