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>
This commit is contained in:
Peter Hutterer 2014-03-27 11:04:24 +10:00
parent fe4a40cdec
commit c073003691
4 changed files with 32 additions and 2 deletions

View file

@ -1,3 +1,6 @@
SUBDIRS = src doc test tools
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
valgrind:
(cd test; $(MAKE) valgrind)

View file

@ -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

View file

@ -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

View file

@ -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
}