scripts/valgrind-wrapper.sh
author Alpar Juttner <alpar@cs.elte.hu>
Sun, 06 May 2012 16:52:11 +0200
branch1.2
changeset 1142 4764031c082c
permissions -rwxr-xr-x
Merge bugfix #441 to branch 1.2
ladanyi@840
     1
#!/bin/sh
ladanyi@840
     2
ladanyi@840
     3
# Run in valgrind, with leak checking enabled
ladanyi@840
     4
ladanyi@840
     5
valgrind -q --leak-check=full "$@" 2> .valgrind-log
ladanyi@840
     6
ladanyi@840
     7
# Save the test result
ladanyi@840
     8
ladanyi@840
     9
result="$?"
ladanyi@840
    10
ladanyi@840
    11
# Valgrind should generate no error messages
ladanyi@840
    12
ladanyi@840
    13
log_contents="`cat .valgrind-log`"
ladanyi@840
    14
ladanyi@840
    15
if [ "$log_contents" != "" ]; then
ladanyi@840
    16
        cat .valgrind-log >&2
ladanyi@840
    17
        result=1
ladanyi@840
    18
fi
ladanyi@840
    19
ladanyi@840
    20
rm -f .valgrind-log
ladanyi@840
    21
ladanyi@840
    22
exit $result