Commit 22cd7b15e8d65f855f2739bf0e20d9f1319c4c4b

Authored by Loic Dachary
Committed by Loic Dachary
1 parent 62b702d5
Exists in master and in 1 other branch v3

add --enable-valgrind for make check

If --enable-valgrind is given to ./configure, all tests are run with
valgrind set to fail if an error is reported ( --error-exitcode=1 )

Signed-off-by: Loic Dachary <loic@dachary.org>
Showing 2 changed files with 11 additions and 1 deletions   Show diff stats
configure.ac
... ... @@ -60,5 +60,11 @@ AC_ARG_ENABLE([sse],
60 60 fi]
61 61 )
62 62  
  63 +AC_ARG_ENABLE([valgrind],
  64 + [AS_HELP_STRING([--enable-valgrind], [run tests with valgrind])],
  65 + [],
  66 + [enable_valgrind=no])
  67 +AM_CONDITIONAL(ENABLE_VALGRIND, test "x$enable_valgrind" != xno)
  68 +
63 69 AC_CONFIG_FILES([Makefile src/Makefile tools/Makefile test/Makefile examples/Makefile])
64 70 AC_OUTPUT
... ...
tools/Makefile.am
... ... @@ -33,9 +33,13 @@ gf_inline_time_SOURCES = gf_inline_time.c
33 33 #gf_inline_time_LDFLAGS = -lgf_complete
34 34 gf_inline_time_LDADD = ../src/libgf_complete.la
35 35  
  36 +if ENABLE_VALGRIND
  37 +VALGRIND = | sed -e 's|^|../libtool --mode=execute valgrind --quiet --error-exitcode=1 --tool=memcheck |'
  38 +endif
  39 +
36 40 # gf_unit tests as generated by gf_methods
37 41 gf_unit_w%.sh: gf_methods
38   - ./$^ $(@:gf_unit_w%.sh=%) -A -U > $@ || rm $@
  42 + ./$^ $(@:gf_unit_w%.sh=%) -A -U ${VALGRIND} > $@ || rm $@
39 43  
40 44 TESTS = gf_unit_w128.sh \
41 45 gf_unit_w64.sh \
... ...