Next: ax_var_timezone_externals, Previous: ax_upload, Up: The Macros
AX_VALGRIND_CHECK()
Checks whether Valgrind is present and, if so, allows running ‘make check‘ under a variety of Valgrind tools to check for memory and threading errors.
Defines VALGRIND_CHECK_RULES which should be substituted in your Makefile; and $enable_valgrind which can be used in subsequent configure output. VALGRIND_ENABLED is defined and substituted, and corresponds to the value of the –enable-valgrind option, which defaults to being enabled if Valgrind is installed and disabled otherwise.
If unit tests are written using a shell script and automake’s LOG_COMPILER system, the $(VALGRIND) variable can be used within the shell scripts to enable Valgrind, as described here:
https://www.gnu.org/software/gnulib/manual/html_node/Running-self_002dtests-under-valgrind.html
Usage example:
configure.ac:
AX_VALGRIND_CHECK
Makefile.am:
@VALGRIND_CHECK_RULES@ VALGRIND_SUPPRESSIONS_FILES = my-project.supp EXTRA_DIST = my-project.supp
This results in a "check-valgrind" rule being added to any Makefile.am which includes "@VALGRIND_CHECK_RULES@" (assuming the module has been configured with –enable-valgrind). Running ‘make check-valgrind‘ in that directory will run the module’s test suite (‘make check‘) once for each of the available Valgrind tools (out of memcheck, helgrind, drd and sgcheck), and will output results to test-suite-$toolname.log for each. The target will succeed if there are zero errors and fail otherwise.
The macro supports running with and without libtool.
Download the latest version of ax_valgrind_check.m4 or browse the macro’s revision history.
Copyright © 2014, 2015 Philip Withnall philip.withnall@collabora.co.uk
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.
Next: ax_var_timezone_externals, Previous: ax_upload, Up: The Macros