scripts/valgrind-wrapper.sh
changeset 1099 ad40f7d32846
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/scripts/valgrind-wrapper.sh	Sun Aug 11 15:28:12 2013 +0200
     1.3 @@ -0,0 +1,22 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +# Run in valgrind, with leak checking enabled
     1.7 +
     1.8 +valgrind -q --leak-check=full "$@" 2> .valgrind-log
     1.9 +
    1.10 +# Save the test result
    1.11 +
    1.12 +result="$?"
    1.13 +
    1.14 +# Valgrind should generate no error messages
    1.15 +
    1.16 +log_contents="`cat .valgrind-log`"
    1.17 +
    1.18 +if [ "$log_contents" != "" ]; then
    1.19 +        cat .valgrind-log >&2
    1.20 +        result=1
    1.21 +fi
    1.22 +
    1.23 +rm -f .valgrind-log
    1.24 +
    1.25 +exit $result