Add helgrind and drd checkers

This commit is contained in:
Andrea Mazzoleni 2015-10-30 22:32:49 +01:00
parent 8ff39bb9bf
commit 405a3648e0
5 changed files with 86 additions and 10 deletions

View file

@ -163,10 +163,18 @@ CHECKFLAGS_VERBOSE = $(CHECKFLAGS_BASE) -v -G
CHECKFLAGS = $(CHECKFLAGS_BASE) -q -q -q
# Number of files to create
if !HAVE_MEMORY_CHECKER
CHECKCOUNT = 1000
else
CHECKCOUNT = 500
endif
# Size of files to create
if !HAVE_MEMORY_CHECKER
CHECKSIZE = 4000
else
CHECKSIZE = 100
endif
CONF = $(srcdir)/test/test-par6.conf
HOLE = $(srcdir)/test/test-par6-hole.conf
@ -191,11 +199,21 @@ check-local:
mkdir bench/pool
echo --- Stream
$(TESTENV) ./mkstream$(EXEEXT)
if HAVE_THREAD_CHECKER
#### THREAD TEST ####
echo --- Create some files
$(TESTENV) ./mktest$(EXEEXT) generate 1 6 $(CHECKCOUNT) $(CHECKSIZE)
echo --- Some commands that use threads
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) sync
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) test-rewrite
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) scrub
else
#### COMMAND LINE ####
echo --- Help
$(TESTENV) ./snapraid$(EXEEXT) --test-skip-device -H
$(TESTENV) ./snapraid$(EXEEXT) --test-skip-device -V
$(TESTENV) ./mktest$(EXEEXT)
if !HAVE_MEMORY_CHECKER
if HAVE_EMULATOR
# Run the self test in AVX2
$(TESTENV_AVX2) ./snapraid$(EXEEXT) --test-skip-device -c $(CONF) status
@ -210,6 +228,7 @@ else
# Run the speed test natively
$(TESTENV) ./snapraid$(EXEEXT) --test-skip-device -T
endif
endif
#### EMPTY ####
echo --- Some commands with empty array
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS_VERBOSE) -c $(CONF) diff
@ -276,7 +295,7 @@ endif
rm bench/content bench/?-content
# Now rebuild the array with alpha order and murmur3 and do some commands
# Later we will convert it to spooky2 to test both hashes
$(FAILENV) ./snapraid$(EXEEXT) $(CHECKFLAGS_VERBOSE) -c $(CONF) --test-expect-need-sync diff > output.log
$(FAILENV) ./snapraid$(EXEEXT) $(CHECKFLAGS_VERBOSE) -c $(CONF) --test-expect-need-sync diff > output.log
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) --test-force-murmur3 --test-force-autosave-at 100 sync
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS_VERBOSE) -c $(CONF) dup -l test.log
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS_VERBOSE) -c $(CONF) list -l test.log > output.log
@ -404,7 +423,7 @@ endif
echo HASH > bench/disk1/HASH-RM
$(FAILENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) --test-run "rm bench/disk1/HASH-RM" --test-expect-failure -h sync
echo HASH > bench/disk1/HASH-CHMOD
# Doesn't run this test as root because the root user overrride permissions
# Doesn't run this test as root because the root user override permissions
if [[ $$EUID -ne 0 ]]; then \
$(FAILENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) --test-run "chmod a-r bench/disk1/HASH-CHMOD" --test-expect-failure -h sync; \
fi
@ -511,6 +530,7 @@ endif
mv bench/disk4/a/7* bench/disk4/b/
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) sync
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) check
if !HAVE_MEMORY_CHECKER
#### RECOVER 1 ####
echo --- Delete one disk, fix and check with PAR1
rm -r bench/disk3
@ -594,6 +614,7 @@ endif
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(PAR6) fix -l test.log
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) check
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) sync
endif
#### MULTI STEP ####
echo --- Delete some files and create some new, sync and check in multiple steps
rm bench/disk1/a/4*
@ -813,6 +834,7 @@ endif
echo --- Sync after all the fixes
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) sync
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) check
endif
echo Success!
# Manual testing

View file

@ -189,18 +189,44 @@ AC_ARG_ENABLE([valgrind],
TESTENV="$VALGRIND --leak-check=full --error-exitcode=1"
FAILENV="$VALGRIND --error-exitcode=1"
CFLAGS="$CFLAGS -DCHECKER"
MEMORY_CHECKER=1
],
[])
AC_ARG_ENABLE([sgcheck],
[AS_HELP_STRING([--enable-sgcheck],[enable the use of sgcheck in testing])],
[
TESTENV="$VALGRIND --tool=exp-sgcheck --suppressions=sgcheck.supp --error-exitcode=1"
TESTENV="$VALGRIND --tool=exp-sgcheck --suppressions=valgrind.supp --error-exitcode=1"
FAILENV="$TESTENV"
CFLAGS="$CFLAGS -DCHECKER"
MEMORY_CHECKER=1
],
[])
AM_CONDITIONAL(HAVE_MEMORY_CHECKER, [test x"$MEMORY_CHECKER" != x])
AC_ARG_ENABLE([helgrind],
[AS_HELP_STRING([--enable-helgrind],[enable the use of helgrind in testing])],
[
TESTENV="$VALGRIND --tool=helgrind --suppressions=valgrind.supp --error-exitcode=1"
FAILENV="$TESTENV"
CFLAGS="$CFLAGS -DCHECKER"
THREAD_CHECKER=1
],
[])
AC_ARG_ENABLE([drd],
[AS_HELP_STRING([--enable-drd],[enable the use of drd in testing])],
[
TESTENV="$VALGRIND --tool=drd --suppressions=valgrind.supp --error-exitcode=1"
FAILENV="$TESTENV"
CFLAGS="$CFLAGS -DCHECKER"
THREAD_CHECKER=1
],
[])
AM_CONDITIONAL(HAVE_THREAD_CHECKER, [test x"$THREAD_CHECKER" != x])
AC_ARG_ENABLE([sde],
[AS_HELP_STRING([--enable-sde],[enable the use of SDE emulator in testing])],
dnl p4 -> Pentium4 with SSE2

View file

@ -26,6 +26,22 @@ if ! make check distclean; then
exit 1
fi
if ! ./configure --enable-helgrind; then
exit 1
fi
if ! make check distclean; then
exit 1
fi
if ! ./configure --enable-drd; then
exit 1
fi
if ! make check distclean; then
exit 1
fi
if ! ./configure ; then
exit 1
fi

View file

@ -1,7 +0,0 @@
{
printf reports false positves when printing more than one variables at time
exp-sgcheck:SorG
...
fun:printf
}

19
valgrind.supp Normal file
View file

@ -0,0 +1,19 @@
{
Global counter of allocated memory
Helgrind:Race
fun:malloc_nofail
}
{
Global counter of allocated memory
drd:ConflictingAccess
fun:malloc_nofail
}
{
printf reports false positves when printing more than one variables at time
exp-sgcheck:SorG
...
fun:printf
}