summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorPavel Šimerda <psimerda@redhat.com>2013-03-22 19:45:11 +0100
committerPavel Šimerda <psimerda@redhat.com>2013-03-22 23:08:20 +0100
commit2675af05b9646d38cf86e0ba8d53151328c87a98 (patch)
tree444b881a485acedf7b0b59f1ac6b8738b0ae3e7d /configure.ac
parentd57198dfa41ca5f2e6d5e366b74b7b058b4c4b08 (diff)
downloadNetworkManager-2675af05b9646d38cf86e0ba8d53151328c87a98.tar.gz
testing: support for valgrind memory checking
Use @VALGRIND_RULES@ in Makefile.am for modules that you want to check for memory leaks.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac13
1 files changed, 11 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index fba13a45b3..4b6073c4e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -599,21 +599,29 @@ VAPIGEN_CHECK(0.17.1.24)
# Tests, utilities and documentation
AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests=root|yes|no], [Build NetworkManager tests (default: yes)]))
+AC_ARG_WITH(valgrind, AS_HELP_STRING([--with-valgrind=yes|no|path], [Use valgrind to memory-check the tests (default: yes)]))
AC_ARG_ENABLE(doc, AS_HELP_STRING([--enable-doc], [Build NetworkManager documentation (default: no)]))
# Fallback to --with-tests and with-docs
AC_ARG_WITH(tests, AS_HELP_STRING([--with-tests], [Build NetworkManager tests (deprecated)]))
AC_ARG_WITH(docs, AS_HELP_STRING([--with-docs], [Build NetworkManager documentation (deprecated)]))
AS_IF([test -n "$with_tests"], enable_tests="$with_tests")
AS_IF([test -n "$with_docs"], enable_doc="$with_docs")
-# Default to --enable-tests and --disable-docs
+# Default to --enable-tests --with-valgrind --disable-docs
AS_IF([test -z "$enable_tests"], enable_tests="yes")
+AS_IF([test -z "$with_valgrind"], with_valgrind="yes")
AS_IF([test -z "$enable_doc"], enable_doc="no")
# Normalize values
AS_IF([test "$enable_tests" != "yes" -a "$enable_tests" != "root"], enable_tests="no")
AS_IF([test "$enable_doc" != "yes"], enable_doc="no")
-# Add conditionals
+# Search for tools
+AS_IF([test "$with_valgrind" == "yes"],
+ [AC_PATH_PROGS(with_valgrind, valgrind, no)])
+# Add conditionals and substitutions
AM_CONDITIONAL(ENABLE_TESTS, test "$enable_tests" != "no")
AM_CONDITIONAL(RUN_ROOT_TESTS, test "$enable_tests" == "root")
+AS_IF([test "with_valgrind" != "no"],
+ AC_SUBST(VALGRIND_RULES, "TESTS_ENVIRONMENT = G_SLICE=always-malloc G_DEBUG=gc-friendly $with_valgrind --quiet --error-exitcode=1 --leak-check=full --gen-suppressions=all --suppressions=\$(top_srcdir)/valgrind.suppressions"),
+ AC_SUBST(VALGRIND_RULES, []))
AM_CONDITIONAL(ENABLE_DOC, test "$enable_doc" = "yes")
# Add gtk-doc conditionals
enable_gtk_doc="$enable_doc"
@@ -767,6 +775,7 @@ echo
echo "Miscellaneous:"
echo " documentation: $enable_doc"
echo " tests: $enable_tests"
+echo " valgrind: $with_valgrind"
echo " code coverage: $enable_code_coverage"
echo