Skip to content

Commit

Permalink
Check suppression file in make valgrind; improve make target docs
Browse files Browse the repository at this point in the history
This should make things easier to use for people with different
configurations.
  • Loading branch information
Petr Viktorin committed Dec 5, 2017
1 parent edbb378 commit c85f432
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
22 changes: 20 additions & 2 deletions Doc/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,33 @@ We use several specialized tools for debugging and maintenance.
Make targets
------------

Make targets currently use the ``python3`` executable.
Specify a different one using, for example::

make PYTHON=/usr/local/bin/python

Notable targets are:

``make lcov lcov-open``
Generate and view test coverage for C code.
Requires ``make`` and ``lcov``.
Requires LCOV_.

``make scan-build``
Run static analysis. Requires ``clang``.

``make valgrind``
Run Valgrind to check for memory leaks. Requires ``valgrind``
Run Valgrind_ to check for memory leaks. Requires ``valgrind`` and
a Python suppression file, which you can specify as ``PYTHON_SUPP``, e.g.::

make valgrind PYTHON_SUPP=/your/path/to/valgrind-python.supp

The suppression file is ``Misc/valgrind-python.supp`` in the Python
source distribution, and it's frequently packaged together with
Python development headers.

.. _LCOV: https://github.com/linux-test-project/lcov
.. _Valgrind: http://valgrind.org/


Reference leak tests
--------------------
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ scan-build:

# valgrind memory checker
.PHONY: valgrind
valgrind: build
$(PYTHON_SUPP):
@ >&2 echo "valgrind-python.supp not found"
@ >&2 echo "install Python development files and run:"
@ >&2 echo " $(MAKE) valgrind PYTHON_SUPP=/your/path/to/valgrind-python.supp"
exit 1;

valgrind: build $(PYTHON_SUPP)
valgrind --leak-check=full \
--suppressions=$(PYTHON_SUPP) \
--suppressions=Misc/python-ldap.supp \
Expand Down

0 comments on commit c85f432

Please sign in to comment.