From 37c68721a186be6328349400129c7993c56234a2 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 19 Mar 2011 00:34:36 +0100 Subject: [PATCH] Added valgrind use if available at the make check command --- Makefile.am | 36 ++++++++++++++++++------------------ configure.ac | 1 + 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/Makefile.am b/Makefile.am index b16bd4d1..2808ad5d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -65,36 +65,36 @@ check-local: mkdir test/disk2 mkdir test/disk3 echo --- As empty, sync and check - ./snapraid -c $(srcdir)/test.conf sync - ./snapraid -c $(srcdir)/test.conf check + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf sync + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf check echo --- Create some files, sync and check ./mktest generate 1 3 1000 4000 - ./snapraid -c $(srcdir)/test.conf sync - ./snapraid -c $(srcdir)/test.conf check + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf sync + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf check echo --- Create some more files, sync and check ./mktest generate 2 3 1000 4000 - ./snapraid -c $(srcdir)/test.conf sync - ./snapraid -c $(srcdir)/test.conf check + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf sync + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf check echo --- Delete some files, fix and check rm test/disk1/a* - ./snapraid -c $(srcdir)/test.conf check 2>/dev/null - ./snapraid -c $(srcdir)/test.conf fix 2>/dev/null - ./snapraid -c $(srcdir)/test.conf check + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf check 2>/dev/null + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf fix 2>/dev/null + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf check echo --- Delete the parity, fix and check rm test/parity - ./snapraid -c $(srcdir)/test.conf check 2>/dev/null - ./snapraid -c $(srcdir)/test.conf fix 2>/dev/null - ./snapraid -c $(srcdir)/test.conf check + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf check 2>/dev/null + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf fix 2>/dev/null + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf check echo --- Corrupt the parity, fix and check ./mktest damage 1 10 10000 test/parity - ./snapraid -c $(srcdir)/test.conf check 2>/dev/null - ./snapraid -c $(srcdir)/test.conf fix 2>/dev/null - ./snapraid -c $(srcdir)/test.conf check + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf check 2>/dev/null + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf fix 2>/dev/null + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf check echo --- Corrupt some files, fix and check ./mktest damage 1 1 500 test/disk2/b* - ./snapraid -c $(srcdir)/test.conf check 2>/dev/null - ./snapraid -c $(srcdir)/test.conf fix 2>/dev/null - ./snapraid -c $(srcdir)/test.conf check + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf check 2>/dev/null + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf fix 2>/dev/null + $(VALGRIND) ./snapraid -c $(srcdir)/test.conf check echo Success! # Valgrind testing diff --git a/configure.ac b/configure.ac index c0129dfe..716bcf13 100644 --- a/configure.ac +++ b/configure.ac @@ -9,6 +9,7 @@ AC_CANONICAL_HOST dnl Checks for programs. AC_PROG_CC AC_USE_SYSTEM_EXTENSIONS +AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind --leak-check=full --track-fds=yes --error-exitcode=1],[]) dnl Checks for libraries. AC_SYS_LARGEFILE