[PATCH libevdev 3/3] test: run all tests through valgrind

Peter Hutterer peter.hutterer at who-t.net
Wed May 7 02:03:08 PDT 2014


On Wed, May 07, 2014 at 09:51:16AM +0200, David Herrmann wrote:
> Hi
> 
> On Thu, Apr 24, 2014 at 7:50 AM, Peter Hutterer
> <peter.hutterer at who-t.net> wrote:
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> >  configure.ac               |  7 +++++--
> >  test/Makefile.am           | 17 +++++++++++++++++
> >  test/valgrind.suppressions | 22 ++++++++++++++++++++++
> >  3 files changed, 44 insertions(+), 2 deletions(-)
> >  create mode 100644 test/valgrind.suppressions
> >
> > diff --git a/configure.ac b/configure.ac
> > index 1c57bf9..f63760d 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -68,9 +68,12 @@ AC_SUBST([GNU_LD_FLAGS], $with_ldflags)
> >
> >  PKG_PROG_PKG_CONFIG()
> >  PKG_CHECK_MODULES(CHECK, [check >= 0.9.9], [HAVE_CHECK="yes"], [HAVE_CHECK="no"])
> > -if test "x$HAVE_CHECK" != "xyes"; then
> > -       AC_MSG_WARN([check not found - skipping building unit tests])
> > +if test "x$HAVE_CHECK" = "xyes"; then
> > +       AC_PATH_PROG(VALGRIND, [valgrind])
> > +else
> > +       AC_MSG_WARN([check not found - skipping building unit tests])
> >  fi
> > +AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"])
> >  AM_CONDITIONAL(BUILD_TESTS, [test "x$HAVE_CHECK" = "xyes"])
> >
> >  with_cflags=""
> > diff --git a/test/Makefile.am b/test/Makefile.am
> > index 9cf0726..e076d84 100644
> > --- a/test/Makefile.am
> > +++ b/test/Makefile.am
> > @@ -2,6 +2,8 @@ if BUILD_TESTS
> >  run_tests = test-libevdev test-kernel
> >  build_tests = test-compile-pedantic test-link
> >
> > +EXTRA_DIST =
> > +
> >  .NOTPARALLEL:
> >
> >  noinst_PROGRAMS = $(run_tests) $(build_tests)
> > @@ -51,6 +53,21 @@ test_kernel_SOURCES = \
> >  test_kernel_CFLAGS = -I$(top_srcdir)
> >  test_kernel_LDADD = $(CHECK_LIBS)
> >
> > +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)"
> 
> Are you sure this works without CK_FORK=no?

yep, works

> > +
> > +check: valgrind
> > +
> > +EXTRA_DIST += valgrind.suppressions
> 
> Nitpick: Move that out of "if HAVE_VALGRIND". Otherwise, "make dist"
> might not add it in case you run it on non-valgrind machines (which is
> not what we want).

yeah, good point. I had pushed the original patch already, so I just pushed
a fixup now. Thanks for pointing this out

Cheers,
   Peter
 
> > +endif
> > +
> > +
> >  if GCOV_ENABLED
> >
> >  CLEANFILES = gcov-report.txt
> > diff --git a/test/valgrind.suppressions b/test/valgrind.suppressions
> > new file mode 100644
> > index 0000000..07fae53
> > --- /dev/null
> > +++ b/test/valgrind.suppressions
> > @@ -0,0 +1,22 @@
> > +{
> > +   <timer_create@@GLIBC_2.3.3>
> > +   Memcheck:Param
> > +   timer_create(evp)
> > +   fun:timer_create@@GLIBC_2.3.3
> > +   fun:srunner_run
> > +   fun:main
> > +}
> > +{
> > +   <ioctl_EVIOCGRAB_unaddressable_bytes>
> > +   Memcheck:Param
> > +   ioctl(generic)
> > +   fun:ioctl
> > +   fun:libevdev_grab
> > +}
> > +{
> > +   <ioctl_EVIOCREVOKE_unaddressable_bytes>
> > +   Memcheck:Param
> > +   ioctl(generic)
> > +   fun:ioctl
> > +   fun:test_revoke*
> > +}
> > --
> > 1.9.0
> >
> > _______________________________________________
> > Input-tools mailing list
> > Input-tools at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/input-tools


More information about the Input-tools mailing list