File: valgrind-wrapper.in

package info (click to toggle)
openvswitch 2.3.0%2Bgit20140819-3
  • links: PTS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 24,156 kB
  • sloc: sh: 223,720; ansic: 153,459; python: 13,272; xml: 12,432; perl: 408; makefile: 382
file content (36 lines) | stat: -rwxr-xr-x 823 bytes parent folder | download | duplicates (11)
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
#! /bin/sh

wrap_program=`basename '@wrap_program@'`

# Strip the first directory from $PATH that contains $wrap_program,
# so that below we run the real $wrap_program, not ourselves.
not_found=true
new_path=
first=true
save_IFS=$IFS
IFS=:
for dir in $PATH; do
    IFS=$save_IFS
    if $not_found && test -x "$dir/$wrap_program"; then
        not_found=false
    else
        if $first; then
            first=false
            new_path=$dir
        else
            new_path=$new_path:$dir
        fi
    fi
done
IFS=$save_IFS
if $not_found; then
    echo "$0: error: cannot find $wrap_program in \$PATH" >&2
    exit 1
fi
PATH=$new_path
export PATH

: ${VALGRIND:=valgrind -q --log-file=valgrind.%p --leak-check=full}
exec $VALGRIND $wrap_program "$@"
echo "$0: failed to execute $VALGRIND $wrap_program" "$@" >&2
exit 1