Commit 185295f247698f727fd3bb11c4795e1741bb359e

Authored by Loic Dachary
2 parents 51a1abb9 f940bf3b
Exists in master and in 1 other branch v3

Merge branch 'wip-valgrind' into 'master'

enable valgrind for tests

See merge request !9
Makefile.am
... ... @@ -6,3 +6,5 @@ ACLOCAL_AMFLAGS = -I m4
6 6  
7 7 include_HEADERS = include/gf_complete.h include/gf_method.h include/gf_rand.h include/gf_general.h
8 8  
  9 +# display the output of failed TESTS after a failed make check
  10 +export VERBOSE = true
... ...
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
... ...
src/gf.c
... ... @@ -910,7 +910,8 @@ void gf_multby_one(void *src, void *dest, int bytes, int xor)
910 910 gf_region_data rd;
911 911  
912 912 if (!xor) {
913   - memcpy(dest, src, bytes);
  913 + if (dest != src)
  914 + memcpy(dest, src, bytes);
914 915 return;
915 916 }
916 917 uls = (unsigned long) src;
... ...
tools/Makefile.am
... ... @@ -33,9 +33,14 @@ 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 +# gf_unit 8 A -1 -m LOG_ZERO_EXT is excluded until http://lab.jerasure.org/jerasure/gf-complete/issues/13 is resolved
  37 +if ENABLE_VALGRIND
  38 +VALGRIND = | perl -p -e 's|^|../libtool --mode=execute valgrind --quiet --error-exitcode=1 --tool=memcheck | if(!/gf_unit 8 A -1 -m LOG_ZERO_EXT/)'
  39 +endif
  40 +
36 41 # gf_unit tests as generated by gf_methods
37 42 gf_unit_w%.sh: gf_methods
38   - ./$^ $(@:gf_unit_w%.sh=%) -A -U > $@ || rm $@
  43 + ./$^ $(@:gf_unit_w%.sh=%) -A -U ${VALGRIND} > $@ || rm $@
39 44  
40 45 TESTS = gf_unit_w128.sh \
41 46 gf_unit_w64.sh \
... ...