summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Dachary <loic-test4@dachary.org>2016-09-13 19:23:39 +0000
committerLoic Dachary <loic-test4@dachary.org>2016-09-13 19:23:39 +0000
commit185295f247698f727fd3bb11c4795e1741bb359e (patch)
tree36827c435bb59800ad73a4a414b2ba00c4b8558f
parent51a1abb9185ec6ea35817620d13322047f4fde4d (diff)
parentf940bf3b5be7eec6fe3e38a11ab65592b1dc10db (diff)
downloadgf-complete-185295f247698f727fd3bb11c4795e1741bb359e.tar.gz
Merge branch 'wip-valgrind' into 'master'
enable valgrind for tests See merge request !9
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac6
-rw-r--r--src/gf.c3
-rw-r--r--tools/Makefile.am7
4 files changed, 16 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index fecda6d..cfb293a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,3 +6,5 @@ ACLOCAL_AMFLAGS = -I m4
include_HEADERS = include/gf_complete.h include/gf_method.h include/gf_rand.h include/gf_general.h
+# display the output of failed TESTS after a failed make check
+export VERBOSE = true
diff --git a/configure.ac b/configure.ac
index ad7bb83..3e8cf18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,5 +60,11 @@ AC_ARG_ENABLE([sse],
fi]
)
+AC_ARG_ENABLE([valgrind],
+ [AS_HELP_STRING([--enable-valgrind], [run tests with valgrind])],
+ [],
+ [enable_valgrind=no])
+AM_CONDITIONAL(ENABLE_VALGRIND, test "x$enable_valgrind" != xno)
+
AC_CONFIG_FILES([Makefile src/Makefile tools/Makefile test/Makefile examples/Makefile])
AC_OUTPUT
diff --git a/src/gf.c b/src/gf.c
index b9caa26..b7a5c01 100644
--- a/src/gf.c
+++ b/src/gf.c
@@ -910,7 +910,8 @@ void gf_multby_one(void *src, void *dest, int bytes, int xor)
gf_region_data rd;
if (!xor) {
- memcpy(dest, src, bytes);
+ if (dest != src)
+ memcpy(dest, src, bytes);
return;
}
uls = (unsigned long) src;
diff --git a/tools/Makefile.am b/tools/Makefile.am
index eb27d4a..a9dd8b9 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -33,9 +33,14 @@ gf_inline_time_SOURCES = gf_inline_time.c
#gf_inline_time_LDFLAGS = -lgf_complete
gf_inline_time_LDADD = ../src/libgf_complete.la
+# gf_unit 8 A -1 -m LOG_ZERO_EXT is excluded until http://lab.jerasure.org/jerasure/gf-complete/issues/13 is resolved
+if ENABLE_VALGRIND
+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/)'
+endif
+
# gf_unit tests as generated by gf_methods
gf_unit_w%.sh: gf_methods
- ./$^ $(@:gf_unit_w%.sh=%) -A -U > $@ || rm $@
+ ./$^ $(@:gf_unit_w%.sh=%) -A -U ${VALGRIND} > $@ || rm $@
TESTS = gf_unit_w128.sh \
gf_unit_w64.sh \