]> git.neil.brown.name Git - wiggle.git/commitdiff
Add "make valgrind"
authorNeilBrown <neilb@suse.de>
Thu, 14 Feb 2013 05:53:42 +0000 (16:53 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 14 Feb 2013 05:53:42 +0000 (16:53 +1100)
This runs the test suite under valgrind and complains if any
errors are detected.

Signed-off-by: NeilBrown <neilb@suse.de>
Makefile
dotest

index 46ab76940b4cdb358aa9b87ce8a35acc44d9ae57..212b13a88b91d203a652bcf6c15454ac6588475b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,6 +26,9 @@ split.o :: ccan/hash/hash.h config.h
 test: wiggle dotest
        ./dotest
 
+valgrind: wiggle dotest
+       ./dotest valgrind
+
 wiggle.man : wiggle.1
        nroff -man wiggle.1 > wiggle.man
 
diff --git a/dotest b/dotest
index 62ba094f87219e275bbf277db69bbfb766c8c9c1..0f622118025c959a7881395d4623ef26541a20ce 100755 (executable)
--- a/dotest
+++ b/dotest
@@ -29,7 +29,11 @@ if $TIME true > /dev/null 2>&1
 then :
 else TIME=
 fi
-#TIME=valgrind
+vallog=/tmp/valg.log-$$
+> $vallog
+if [ " $1" = " valgrind" ]; then
+  TIME="valgrind --log-file=$vallog"
+fi
 status=0
 ok=0
 fail=0
@@ -94,6 +98,9 @@ do
                 ;;
    esac
    if [ $xit = 0 ]; then msg=SUCCEEDED; else msg=FAILED; fi
+   if grep 'ERROR SUMMARY: [1-9]' $vallog > /dev/null 2>&1
+   then msg="$msg WITH VALGRIND ERRORS"; xit=1
+   fi
    echo $path $msg `grep -v 'Command exited' .time 2> /dev/null`
    rm -f .time
    exit $xit