[PATCH libinput 6/9] test: automatically run the tests against valgrind for leaks
Peter Hutterer
peter.hutterer at who-t.net
Thu Mar 27 21:38:49 PDT 2014
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
The main problem: valgrind is slow. I'm ok with taking the automatic hook
out and requiring a make valgrind separate call.
Makefile.am | 3 +++
configure.ac | 9 +++++++--
test/Makefile.am | 13 +++++++++++++
test/valgrind.suppressions | 10 ++++++++++
4 files changed, 33 insertions(+), 2 deletions(-)
create mode 100644 test/valgrind.suppressions
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 afd04a4..5c4073d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -72,10 +72,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 9b71511..adb58e9 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -68,4 +68,17 @@ test_build_linker_SOURCES = build-pedantic.c
test_build_linker_CFLAGS = -I$(top_srcdir)/src
test_build_linker_LDADD = $(top_builddir)/src/libinput.la
+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..3401496
--- /dev/null
+++ b/test/valgrind.suppressions
@@ -0,0 +1,10 @@
+{
+ 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
+}
+
--
1.8.5.3
More information about the wayland-devel
mailing list