File: valgrind.sh

package info (click to toggle)
pysdl2 0.9.7%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,824 kB
  • sloc: python: 17,244; makefile: 195; sh: 32
file content (40 lines) | stat: -rwxr-xr-x 863 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh

# Path to the debug version of python
: ${PYDEBUG:="/opt/python-debug/bin/python"}
# Valgrind checker application and the default arguments to use.
: ${VALGRIND:="valgrind"}
: ${VALGRINDARGS:="--tool=memcheck --leak-check=summary"}
: ${PYTHONPATH:="`dirname $0`/../"}

usage()
{
    echo "usage: `basename $0` [-f|-r|-s] module ..."
}

while getopts frs arg; do
    case $arg in
        f)
            DEFARGS="--tool=memcheck --leak-check=full"
            ;;
        r)
            DEFARGS="--tool=memcheck --leak-check=full --show-reachable=yes"
            ;;
        s)
            DEFARGS="--tool=memcheck --leak-check=summary"
            ;;
        \? | h)
            usage
            exit 2
    esac
done

shift $(expr $OPTIND - 1)
if [ $# -eq 0 ]; then
    usage
    exit 1
fi

for f in $@; do
    $VALGRIND $DEFARGS $PYDEBUG -B -m $f
done