Академический Документы
Профессиональный Документы
Культура Документы
C coverage tool
===============
This directory contains a tool to generate C code-coverage reports
using valgrind's callgrind tool.
Prerequisites
------------* `Valgrind <http://www.valgrind.org/>`_ (3.5.0 tested, earlier
versions may work)
* `Pygments <http://www.pygments.org/>`_ (0.11 or later required)
C code-coverage
--------------Generating C code coverage reports requires two steps:
* Collecting coverage results (from valgrind)
* Generating a report from one or more sets of results
For most cases, it is good enough to do::
> c_coverage_collect.sh python -c "import numpy; numpy.test()"
> c_coverage_report.py callgrind.out.pid
which will run all of the Numpy unit tests, create a directory called
`coverage` and place the coverage results there.
In a more advanced scenario, you may wish to run individual unit tests
(since running under valgrind slows things down) and combine multiple
results files together in a single report.
Collecting results
``````````````````
To collect coverage results, you merely run the python interpreter
under valgrind's callgrind tool. The `c_coverage_collect.sh` helper
script will pass all of the required arguments to valgrind.
For example, in typical usage, you may want to run all of the Numpy
unit tests::
> c_coverage_collect.sh python -c "import numpy; numpy.test()"
This will output a file ``callgrind.out.pid`` containing the results of
the run, where ``pid`` is the process id of the run.
Generating a report
```````````````````
To generate a report, you pass the ``callgrind.out.pid`` output file to
the `c_coverage_report.py` script::
> c_coverage_report.py callgrind.out.pid
To combine multiple results files together, simply list them on the