scripts/valgrind-wrapper.sh
changeset 1107 2b6bffe0e7e8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/scripts/valgrind-wrapper.sh	Tue Dec 20 18:15:14 2011 +0100
     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