1 @node Running self-tests under valgrind
2 @section Running self-tests under valgrind
4 For projects written in C or similar languages, running the self-tests
5 under Valgrind can reveal hard to find memory issues. The
6 @code{valgrind-tests} module searches for Valgrind and declares the
7 @code{VALGRIND} automake variable for use with automake's
8 @code{TESTS_ENVIRONMENT}.
10 After importing the @code{valgrind-tests} module to your project, you
11 use it by adding the following to the @code{Makefile.am} that runs the
15 TESTS_ENVIRONMENT = $(VALGRIND)
18 This will run all self-checks under valgrind. This can be wasteful if
19 you have many shell scripts or other non-binaries. Using the Automake
20 parallel-tests feature, this can be avoided by using the following
24 AUTOMAKE_OPTIONS = parallel-tests
25 TEST_EXTENSIONS = .pl .sh
26 LOG_COMPILER = $(VALGRIND)
29 Then valgrind will only be used for the non-.sh and non-.pl tests.
30 However, this means that binaries invoked through scripts will not be
31 invoked under valgrind, which could be solved by adding the following:
34 TESTS_ENVIRONMENT = VALGRIND='$(VALGRIND)'
37 And then modify the shell scripts to invoke the binary prefixed with