summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2014-03-27 11:04:24 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2014-04-10 11:11:56 +1000
commitc0730036915b6965846e043613939433dd5f7c1e (patch)
treed062178c975dd9456ffea50d98af0f4f5a3f3167
parentfe4a40cdec39ae77d9c6ced4796711b51dfe886c (diff)
test: automatically run the tests against valgrind for leaks
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jonas Ã…dahl <jadahl@gmail.com>
-rw-r--r--Makefile.am3
-rw-r--r--configure.ac9
-rw-r--r--test/Makefile.am13
-rw-r--r--test/valgrind.suppressions9
4 files changed, 32 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 08bf7ce..05698ba 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,6 @@
SUBDIRS = src doc test tools
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+
+valgrind:
+ (cd test; $(MAKE) valgrind)
diff --git a/configure.ac b/configure.ac
index faae148..4cb0868 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,10 +73,15 @@ if test "x$build_tests" = "xauto"; then
build_tests="yes"
fi
fi
-if test "x$build_tests" = "xyes" -a "x$HAVE_CHECK" = "xno"; then
- AC_MSG_ERROR([Cannot build tests, check is missing])
+if test "x$build_tests" = "xyes"; then
+ if test "x$HAVE_CHECK" = "xno"; then
+ AC_MSG_ERROR([Cannot build tests, check is missing])
+ fi
+
+ AC_PATH_PROG(VALGRIND, [valgrind])
fi
+AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"])
AM_CONDITIONAL(BUILD_TESTS, [test "x$build_tests" = "xyes"])
AC_CONFIG_FILES([Makefile
diff --git a/test/Makefile.am b/test/Makefile.am
index 1a628de..49fe5f0 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -74,4 +74,17 @@ test_build_linker_LDADD = $(top_builddir)/src/libinput.la
test_build_cxx_SOURCES = build-cxx.cc
test_build_cxx_CXXFLAGS = -Wall -Wextra -Wno-unused-parameter $(AM_CXXFLAGS)
+if HAVE_VALGRIND
+VALGRIND_FLAGS=--leak-check=full \
+ --quiet \
+ --error-exitcode=3 \
+ --suppressions=$(srcdir)/valgrind.suppressions
+
+valgrind:
+ $(MAKE) check-TESTS LOG_COMPILER="$(VALGRIND)" LOG_FLAGS="$(VALGRIND_FLAGS)"
+
+check: valgrind
+
+endif
endif
+EXTRA_DIST=valgrind.suppressions
diff --git a/test/valgrind.suppressions b/test/valgrind.suppressions
new file mode 100644
index 0000000..3ba7f29
--- /dev/null
+++ b/test/valgrind.suppressions
@@ -0,0 +1,9 @@
+{
+ srunner_run::timer_create-uninitialized-bytes
+ Memcheck:Param
+ timer_create(evp)
+ fun:timer_create@@GLIBC_2.3.3
+ fun:srunner_run
+ fun:litest_run
+ fun:main
+}