summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2010-05-20 08:29:56 +0200
committerSimon Josefsson <simon@josefsson.org>2010-05-20 08:29:56 +0200
commite85c3f8fb0807bed4ce05f5b410d1e4d3929bc6e (patch)
tree37cb4f67e711141b7574449a18b583087ec19bec /doc
parent75dc5a3dbe3c65f57adc9533561100079922e180 (diff)
downloadgnulib-e85c3f8fb0807bed4ce05f5b410d1e4d3929bc6e.tar.gz
Add new module valgrind-tests.
Diffstat (limited to 'doc')
-rw-r--r--doc/gnulib.texi3
-rw-r--r--doc/valgrind-tests.texi38
2 files changed, 41 insertions, 0 deletions
diff --git a/doc/gnulib.texi b/doc/gnulib.texi
index 62f969ed17..4cbc9e74b7 100644
--- a/doc/gnulib.texi
+++ b/doc/gnulib.texi
@@ -6416,6 +6416,7 @@ This list of functions is sorted according to the header that declares them.
* func::
* warnings::
* manywarnings::
+* Running self-tests under valgrind::
@end menu
@node alloca
@@ -6514,6 +6515,8 @@ generated automatically.
@include manywarnings.texi
+@include valgrind-tests.texi
+
@node GNU Free Documentation License
@appendix GNU Free Documentation License
diff --git a/doc/valgrind-tests.texi b/doc/valgrind-tests.texi
new file mode 100644
index 0000000000..ec3720214a
--- /dev/null
+++ b/doc/valgrind-tests.texi
@@ -0,0 +1,38 @@
+@node Running self-tests under valgrind
+@section Running self-tests under valgrind
+
+For projects written in C or similar languages, running the self-tests
+under Valgrind can reveal hard to find memory issues. The
+@code{valgrind-tests} module searches for Valgrind and declares the
+@code{VALGRIND} automake variable for use with automake's
+@code{TESTS_ENVIRONMENT}.
+
+After importing the @code{valgrind-tests} module to your project, you
+use it by adding the following to the @code{Makefile.am} that runs the
+self-tests:
+
+@smallexample
+TESTS_ENVIRONMENT = $(VALGRIND)
+@end smallexample
+
+This will run all self-checks under valgrind. This can be wasteful if
+you have many shell scripts or other non-binaries. Using the Automake
+parallel-tests feature, this can be avoided by using the following
+instead:
+
+@smallexample
+AUTOMAKE_OPTIONS = parallel-tests
+TEST_EXTENSIONS = .pl .sh
+LOG_COMPILER = $(VALGRIND)
+@end smallexample
+
+Then valgrind will only be used for the non-.sh and non-.pl tests.
+However, this means that binaries invoked through scripts will not be
+invoked under valgrind, which could be solved by adding the following:
+
+@smallexample
+TESTS_ENVIRONMENT = VALGRIND='$(VALGRIND)'
+@end smallexample
+
+And then modify the shell scripts to invoke the binary prefixed with
+@code{$VALGRIND}.